62,074
社区成员
发帖
与我相关
我的任务
分享
OleDbConnection conn = new OleDbConnection("Provider=SQLOLEDB;Data Source=ZHOUCL;Integrated Security=SSPI;Initial Catalog=TestDW");
try
{
String str="select 密码 from 用户表 where 用户名='"+TextBox1.Text+"'";
OleDbCommand cmd = new OleDbCommand(str, conn);
conn.Open();
String result = (String)cmd.ExecuteScalar();
if (result == TextBox2.Text.ToString())
{
TextBox3.Text = "连接成功...";
}
conn.Close();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
OleDbConnection conn = new OleDbConnection("Provider=SQLOLEDB;Data Source=ZHOUCL;Integrated Security=SSPI;Initial Catalog=TestDW");
try
{
conn.Open();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
String str="select 密码 from 用户表 where 用户名='"+TextBox1.Text+"'";
OleDbCommand cmd = new OleDbCommand(str, conn);
conn.Open(); //打开数据库连接
String result = (String)cmd.ExecuteScalar();
if (result == TextBox2.Text.ToString())
{
TextBox3.Text = "连接成功...";
}
conn.Close();