我想知道我哪错了我不知道怎么改谢谢了public partial class chat_login :System.Web.UI.Page{private System.Data.OleDb.OleDbCommand objselectcomm;private System.Data.OleDb.OleDbConnection objchatconn;protected void Page_Load(object sende
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/24 06:48:02
我想知道我哪错了我不知道怎么改谢谢了public partial class chat_login :System.Web.UI.Page{private System.Data.OleDb.OleDbCommand objselectcomm;private System.Data.OleDb.OleDbConnection objchatconn;protected void Page_Load(object sende
我想知道我哪错了我不知道怎么改谢谢了
public partial class chat_login :System.Web.UI.Page
{
private System.Data.OleDb.OleDbCommand objselectcomm;
private System.Data.OleDb.OleDbConnection objchatconn;
protected void Page_Load(object sender,EventArgs e)
{
}
protected void btn2_Click(object sender,EventArgs e)
{
this.txtname.Text = "";
this.ckbox.Checked = false;
}
protected void ImageButton1_Click(object sender,ImageClickEventArgs e)
{
SqlConnection con=new SqlConnection();
SqlCommand com=new SqlCommand();
string myread="dataread from yonghu3 where name='"+this.txtname.Text+"',pass='"+this.txtpwd.Text+"'";
try
{
if(txtname!=null&&txtpwd!=null)
{
if("dataread from yonghu3 where name='"+this.txtname.Text+"',pass='"+this.txtpwd.Text+"'")
{
con.ConnectionString="server=.;integrated security=sspi;database=yonghu";
com.Connection= con;
com.CommandText=myread;
com.Connection.Open();
com.ExecuteReader();
Response.Redirect("jiyilt1.aspx");
}
else
Label1.Text="用户名或密码不正确";
}
else
Label1.Text="请输入用户名和密码";
}
catch(System.Exception msg)
{
Response.Write(msg.Message.ToString());
}
finally
{
com.Connection.Close();
}
}
protected void ImageButton2_Click(object sender,ImageClickEventArgs e)
{
Response.Redirect("zhuce.aspx");
}
}
编译错误
说明:在编译向该请求提供服务所需资源的过程中出现错误.请检查下列特定错误详细信息并适当地修改源代码.
编译器错误消息:CS0029:无法将类型“string”隐式转换为“bool”
行 41:if("dataread from yonghu3 where name='"+this.txtname.Text+"',pass='"+this.txtpwd.Text+"'")
我想知道我哪错了我不知道怎么改谢谢了public partial class chat_login :System.Web.UI.Page{private System.Data.OleDb.OleDbCommand objselectcomm;private System.Data.OleDb.OleDbConnection objchatconn;protected void Page_Load(object sende
if("dataread from yonghu3 where name='"+this.txtname.Text+"',pass='"+this.txtpwd.Text+"'")
你这个东西是string类型,而if里面需要 bool型的,当然报错啦.