c# 连接MYSQL 获取的数据比实际的少
MySqlConnection myconn = new MySqlConnection("server=192.168.1.3;uid=php;pwd=php;database=db_ename;Charset=utf8");
myconn.Open();
MySqlCommand myNamecmd = new MySqlCommand("set names utf8", myconn);
myNamecmd.ExecuteNonQuery();
DataTable domainTd = db.returnDataTableMysql("select * from domain where Status<>6 and Status<>9 order by DomainId desc", myconn);
-------------------------------------------------
public static DataTable returnDataTableMysql(string mySql, MySqlConnection myConn)
{
DataTable mysqlTable = new DataTable();
using (MySqlCommand mySqlCmd = new MySqlCommand(mySql,myConn))
{
try
{
MySqlDataAdapter mySqlAdapter = new MySqlDataAdapter(mySqlCmd);
mysqlTable.Clear();
mySqlAdapter.Fill(mysqlTable);
}
catch
{
}
}
return mysqlTable;
}
---------------------------
MessageBox.Show(domainTd.Rows.Count.ToString());
显示的数据只有197行,直接进MYSQL执行语句有230行。
------解决方案--------------------路过接分!