OleDbDataAdapter填充DataSet 问题
try
{string mytext="select * from default";
OleDbDataAdapter dr=new OleDbDataAdapter(mytext,myconn);
DataSet ds=new DataSet();
int i=dr.Fill(ds)
if(i!=0)
{
MessageBox.Show("有数据");
}
}
catch
{MessageBox.Show("出现异常");}
这是OleDbDataAdapter的代码,可运行就出现正常,请问这是怎么回事啊
我用OleDbDataReader就可以以正常显示
代码如下
try
{string mytext="select * from default where username='"+UserName+"'";
OleDbCommand mycomm=new OleDbCommand();
OleDbDataReader dr=mycomm.Ex...();
if(dr.Read())
{ MessageBox.Show("有数据");
}
}
catch
{MessageBox.Show("出现异常");}