protected void Button_Click(object sender, EventArgs e)
{
if (((Button)sender).ID == "reset")
{ TextBox1.Text = ""; }
else
{
Submit();
}
}
protected void Submit()
{
OleDbCommand OleCmd;
OleDbConnection conn;
string strCommand;
conn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source=f:\\Data\\image.mdb");
strCommand = "Select UserEmain From Dv_User Where UserName=@txtUserName";
OleCmd = new OleDbCommand(strCommand,conn);
OleCmd.Parameters.Add("@txtUserName", TextBox1.Text);
conn.Open();
object resoult = OleCmd.ExecuteScalar();
if (resoult == null)
{
TextBox2.Text = "Not Found!";
}
else
{
TextBox2.Text= resoult.ToString();
}
}
运行的时候说 至少一个参数没有被指定值。 ,我想是@txtUserName没有被赋值,
但是不明白哪里错了