通过输入用户名(Texbox),按Button去数据库里查找是否存在数据库。 如果有的话,就用Label输出存在;没有的话就说此用户已存在!~~~ 谢谢!
protected void Button1_Click(object sender, EventArgs e)
{
//第一种情况
Label1.Text = TextBox1.Text+"用户已存在";
//第二种情况
Label1.Text = TextBox1.Text + "用户不存在"; }
代码怎么写在{}之间?
protected void Button1_Click(object sender, EventArgs e)
{
//第一种情况
Label1.Text = TextBox1.Text+"用户已存在";
//第二种情况
Label1.Text = TextBox1.Text + "用户不存在"; }
代码怎么写在{}之间?
执行sql语句,根据记录数判断
OleDbConnection conn = new OleDbConnection(DataBaseConnectionString);
conn.Open(); //数据库打开
if(DataBaseSelect(selectString))
{
Label1.Text = TextBox1.Text+"用户已存在";
}
else
{
Label1.Text = TextBox1.Text + "用户不存在";
}
conn.Close();
这样吗?
OleDbConnection conn = new OleDbConnection(strConn);
string strInsert="SELECT语句";
OleDbCommand cm = new OleDbCommand(strInsert,conn);
conn.Open();
OleDbDataReader dr=cm.ExecuteReader();
if (dr.Read()){
Label1.Text = TextBox1.Text+"用户已存在";
}
else{
Label1.Text = TextBox1.Text + "用户不存在"; }
conn.Close();