/// <summary>
        /// The FL_mysql_dataadapter
        /// </summary>
        /// <param name="Constring">The Constring<see cref="string"/></param>
        /// <param name="SqlCommand">The SqlCommand<see cref="string"/></param>
        /// <returns>The <see cref="MySqlDataAdapter"/></returns>
        public static MySqlDataAdapter FL_mysql_dataadapter(string Constring, string SqlCommand)
        {
            MySqlDataAdapter da = new MySqlDataAdapter();

            //DataSet ds = new DataSet();
            try
            {
                var Connection = new MySqlConnection(Constring);
                var Cmd        = new MySqlCommand(SqlCommand, Connection);
                Connection.Con_switch();
                da = new MySqlDataAdapter(Cmd);
                //DataTable dt = new DataTable();
                //DA.Fill(dt);
                //ds.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;
                //ds.Tables.Add(dt);
                Connection.Con_switch();
                //Cmd.Dispose();
                //Connection.Dispose();
            }
            catch (MySqlException e)
            {
                MessageBox.Show("Error : " + e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            return(da);
        }
Example #2
0
        /// <summary>
        /// The GetMySqlValue
        /// </summary>
        /// <param name="Cmd">The Cmd<see cref="MySqlCommand"/></param>
        /// <param name="Query">The Query<see cref="string"/></param>
        /// <param name="Con">The Con<see cref="MySqlConnection"/></param>
        /// <returns>The <see cref="string"/></returns>
        public static string GetMySqlValue(this MySqlCommand Cmd, string Query, MySqlConnection Con)
        {
            var c = "";

            Cmd.CommandText = Query;
            Con.Con_switch();
            var reader = Cmd.ExecuteReader();

            while (reader.Read())
            {
                c = reader["salhead_formula"].ToString();
            }
            reader.Close();
            reader.Dispose();
            Con.Con_switch();
            return(c);
        }
        /// <summary>
        /// The FL_mysql_myreader
        /// </summary>
        /// <param name="Connection">The Connection<see cref="MySqlConnection"/></param>
        /// <param name="Cmd">The Cmd<see cref="MySqlCommand"/></param>
        /// <returns>The <see cref="MySqlDataReader"/></returns>
        public static MySqlDataReader FL_mysql_myreader(MySqlConnection Connection, MySqlCommand Cmd)
        {
            MySqlDataReader r = null;

            try
            {
                Connection.Con_switch();
                r = Cmd.ExecuteReader();
            }
            catch (MySqlException e)
            {
                MessageBox.Show("Error : " + e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            return(r);
        }