c# 于access的问题,高手进

来源:百度知道 编辑:UC知道 时间:2024/05/17 04:04:14
程序如下:
OleDbCommand ocomm = new OleDbCommand("select number from storemanagement.fuzhubiao where uername=111 ");
OleDbConnection oconn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=storemanagement.mdb;Persist Security Info=True;Jet OLEDB:Database Password=fang");
DataSet ds = new DataSet();
OleDbDataAdapter oda = new OleDbDataAdapter(ocomm);
oda.SelectCommand.Connection = oconn;
oconn.Open();
oda.Fill(ds);

i = ds.Tables[0].Rows[0][0].ToString();
oconn.Close();
MessageBox.Show(i);
label3.Text = i;
总是错误提示:oda.Fill(ds); 至少有一个参数没有设置
补充:fill()的7种参数方式都试过了

select 语句没问题???
select number from storemanagement.fuzhubiao where uername=111

username 是数字型?还是字符??

如果是字符,加‘’。

另外,如果没有检索到数据呢??,你判断了吗???