string sql = "update user set uPassword=" + TextBox3.Text;的执行命令
conn.ConnectionString=@"Provider=Microsoft.ACE.OLEDB.12.0;DataSource=|DataDirectory|\...
conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\#data.accdb;";
conn.Open(); // 打开数据库
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = conn; // 设置command对象的数据库连接
// 查询的sql语句
cmd.CommandText = "select count(*) from users where uName='" + TextBox1.Text + "' and uPassword='" + TextBox2.Text + "'";
object o = cmd.ExecuteScalar(); // 执行sql语句,返回首行首列值,因为这里只有一行一列,其实就是count(*)
if (Convert.ToInt32(o) > 0) // 如果count(*)的值大于0说明记录存在
{
string sql = "update [user] set [uPassword]=" + TextBox3.Text;
object s = cmd.ExecuteScalar(); //执行修改操作
conn.Close();
Server.Transfer("Default.aspx");
}
else
{
Label3.Text = "用户名或者密码错误";
}
string sql = "update [user] set [uPassword]=" + TextBox3.Text;一句执行不了
怎么该 展开
conn.Open(); // 打开数据库
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = conn; // 设置command对象的数据库连接
// 查询的sql语句
cmd.CommandText = "select count(*) from users where uName='" + TextBox1.Text + "' and uPassword='" + TextBox2.Text + "'";
object o = cmd.ExecuteScalar(); // 执行sql语句,返回首行首列值,因为这里只有一行一列,其实就是count(*)
if (Convert.ToInt32(o) > 0) // 如果count(*)的值大于0说明记录存在
{
string sql = "update [user] set [uPassword]=" + TextBox3.Text;
object s = cmd.ExecuteScalar(); //执行修改操作
conn.Close();
Server.Transfer("Default.aspx");
}
else
{
Label3.Text = "用户名或者密码错误";
}
string sql = "update [user] set [uPassword]=" + TextBox3.Text;一句执行不了
怎么该 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询