访问数据的问题
我编写的代码为:
try
{
objConnection.Open();
string strOleDb="select count(*) from login where name='"+this.textBox1.Text.ToString().Trim()+"'and password='"+this.textBox2.Text.ToString().Trim()+"'";
OleDbCommand cmd=new OleDbCommand(strOleDb,objConnection);
int count=(int)cmd.ExecuteScalar();
if(count==1)
{MessageBox.Show("sucess");}
else
{MessageBox.Show("fail");}
}
它提示说:未处理的"System.Data.oledb.oleDbException"类型的异常出现在System.data.dll中;
麻烦各位老大帮我看看! 谢谢!