public DataTable selectAllPerson()
{
string constr = "UserId=root;Host=localhost;Database=test;password=1234";
MySqlConnection conn = new MySqlConnection(constr);
MySqlDataAdapter sda=new MySqlDataAdapter();
sda.SelectCommand =new MySqlCommand("sp_Select(存储过程名称)",conn);
DataSet ds = new DataSet();
sda.Fill(ds,"T_User");
return ds.Tables["T_User"]; }
public DataTable selectAllPerson()
{
string constr = "UserId=root;Host=localhost;Database=test;password=1234";
MySqlConnection conn = new MySqlConnection(constr);
MySqlDataAdapter sda=new MySqlDataAdapter();
sda.SelectCommand =new MySqlCommand("select * fromT_User",conn);
DataSet ds = new DataSet();
sda.Fill(ds,"T_User");
return ds.Tables["T_User"]; }
为什么上面这个程序执行会出错?
{
string constr = "UserId=root;Host=localhost;Database=test;password=1234";
MySqlConnection conn = new MySqlConnection(constr);
MySqlDataAdapter sda=new MySqlDataAdapter();
sda.SelectCommand =new MySqlCommand("sp_Select(存储过程名称)",conn);
DataSet ds = new DataSet();
sda.Fill(ds,"T_User");
return ds.Tables["T_User"]; }
public DataTable selectAllPerson()
{
string constr = "UserId=root;Host=localhost;Database=test;password=1234";
MySqlConnection conn = new MySqlConnection(constr);
MySqlDataAdapter sda=new MySqlDataAdapter();
sda.SelectCommand =new MySqlCommand("select * fromT_User",conn);
DataSet ds = new DataSet();
sda.Fill(ds,"T_User");
return ds.Tables["T_User"]; }
为什么上面这个程序执行会出错?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货