又有问题了....我
public void bind(object sender,EventArgs E)
{
string strConnection= "Provider=Microsoft.Jet.OleDb.4.0;Data Source= ";
strConnection+=Server.MapPath( "1.mdb ");
OleDbConnection objConnection=new OleDbConnection (strConnection);
String se= "select shuliang from jinhuo where bianhao=@bh and shuliang> =0 ";
OleDbCommand objCommand1 = new OleDbCommand(se,objConnection);
objCommand1.Parameters.Add(new OleDbParameter( "@bh ",OleDbType.Char,40));
objCommand1.Parameters[ "@bh "].Value=bianhao.Text;
OleDbDataAdapter obj = new OleDbDataAdapter(se,objConnection);
DataSet myds=new DataSet();
obj.Fill(myds, "jinhuo ");
dgrdMain.DataSource=myds.Tables[ "jinhuo "].DefaultView;
dgrdMain.DataBind();
}
报错.
至少一个参数没有被指定值.
将String se= "select shuliang from jinhuo where bianhao> =0 and shuliang> =0
正常.
也就是说在读取文本框值的时候有问题.
或者是这里的变量读取值与表格显示一起运行出了问题.
希望哪位高手帮忙解决下.
------解决方案--------------------string bh = TextBox.Text;
string se= "select shuliang from jinhuo where bianhao= " + bh + " and shuliang> =0 ";