private void Button1_Click(object sender, System.EventArgs e)
{
string stringconn="server=127.0.0.1;uid=sa;pwd=;database=teacher";
SqlConnection conn=new SqlConnection(stringconn);
string strSQL="select password from user where id = '"+textBox1.Text+"'";
SqlDataAdapter sqlDataAdapter= new SqlDataAdapter(strSQL,conn);
DataSet ds = new DataSet();
sqlDataAdapter.Fill(ds,"user");
if (ds.Tables["user"].Rows.Count>0)
{
DataRow myDR=ds.Tables["user"].Rows[0];
if (textBox2.Text==myDR["password"].ToString().Trim())
{
Response.Write("<script>window.open('error.htm','main');</script>");}
else Response.Write("<script>window.open('user.aspx','contents');</script>"); }
}为什么链不上数据库
登陆的时候说sa无法登陆iis和sql都采用集成登陆模式如果把pwd后面的密码写了,也无法登陆
{
string stringconn="server=127.0.0.1;uid=sa;pwd=;database=teacher";
SqlConnection conn=new SqlConnection(stringconn);
string strSQL="select password from user where id = '"+textBox1.Text+"'";
SqlDataAdapter sqlDataAdapter= new SqlDataAdapter(strSQL,conn);
DataSet ds = new DataSet();
sqlDataAdapter.Fill(ds,"user");
if (ds.Tables["user"].Rows.Count>0)
{
DataRow myDR=ds.Tables["user"].Rows[0];
if (textBox2.Text==myDR["password"].ToString().Trim())
{
Response.Write("<script>window.open('error.htm','main');</script>");}
else Response.Write("<script>window.open('user.aspx','contents');</script>"); }
}为什么链不上数据库
登陆的时候说sa无法登陆iis和sql都采用集成登陆模式如果把pwd后面的密码写了,也无法登陆
解决方案 »
- 数据库中的tinyint数据类型 C# 用什么接收?
- 小妹想请教一个问题,怎样可以用C#实现闭包的算法啊?
- 装箱和取消装箱有什么具体的应用
- c#中如何判断一个值是否为NULL?C#中不让使用ISDBNULL这个函数
- 请教UdpClient的问题:
- 如何在webform中打开一个excel(.cvs)的文件? System.Diagnostics.Process.Start 这个方法没有成功
- c#程序在自己机子可以运行,在其他没装过C#的机子上运行提示,程序初始化失败,怎么回师?
- 随机内容生成?????????
- C#中有取余、取整的函数吗??
- 关于user32.dll的问题。
- 在使用httpwebrequest时,向servlet提交http的post时,中文都变成了乱码.....
- Excel 重载“Insert”方法未获取“1”参数 什么原因??
采用windows混合验证方式