帮我看看登陆错误原因
protected void Button1_Click(object sender, EventArgs e)
{
if ((TextBox1.Text == "") || (TextBox2.Text == ""))
{
Label1.Text = "账号和密码不能为空!";
}
else
{
string conn = "Data Source=FY1\\SQLEXPRESS;Initial Catalog=web;User ID=fytest;Password=123456";
SqlConnection myconnection=new SqlConnection (conn );
myconnection .Open ();//打开数据库
string comm="select * from tab_manager where M_name='" +TextBox1.Text+ "' and M_password='" +TextBox2.Text+ "'";
SqlCommand cmd=new SqlCommand (comm,myconnection );
SqlDataReader myreader=cmd.ExecuteReader();
if (myreader .Read ())
{
}
else
{
Label1 .Text ="账号和密码错误!";
}
myreader.Close ();
myconnection .Close ();
}
}
当我输入正确的账号和密码时点击登陆出现错误
数据类型 text 和 varchar 在 equal to 运算符中不兼容。
我的表中M_name M_password的数据类型都为text
请大虾帮帮忙,谢谢!!!!