C# MySql Select

            MySqlCommand objCmd = new MySqlCommand("select * from `main_db`.`t_realdailyinfo` ", objConn);
            MySqlCommand objCmd = new MySqlCommand("select * from `main_db`.`t_user` where SysNo = 1 ", objConn);
            MySqlCommand objCmd = new MySqlCommand("select UserName from `main_db`.`t_user` where SysNo = 2 ", objConn);

            // UserName ,SysNo 均为column名称

            MySqlDataReader  r = objCmd.ExecuteReader();
            while (r.Read())
            {             
       
                    //FieldCount为这个表中有多少的列 column
                    int i = r.FieldCount;
                    textBox3.Text = i.ToString();
            }

posted @ 2013-07-10 17:28  wwjdwy  阅读(949)  评论(0编辑  收藏  举报