📄 用户添加—检测.txt
字号:
private void button29_Click(object sender, System.EventArgs e)
{
if (textName1.Text=="" || textPass1.Text =="")
{
MessageBox.Show("您提交的信息不完全","提示!");
return;
}
try
{
string strCon = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source =usermd5.mdb ";
OleDbConnection myConn=new OleDbConnection(strCon);
myConn.Open();
string strInsert = "INSERT INTO cc_admin(usernam,passwor) VALUES ('"
+ textName1.Text +"','"
+ textPass1.Text +"')";
OleDbCommand myCmd = new OleDbCommand(strInsert,myConn);
myCmd.ExecuteNonQuery();
myConn.Close();
MessageBox.Show("插入成功!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,"提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
private void button30_Click(object sender, System.EventArgs e)
{
if (textName1.Text=="" || textPass1.Text =="")
{
MessageBox.Show("您提交的信息不完全","提示!");
return;
}
try
{
string strCon = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source =usermd5.mdb ";
OleDbConnection myConn=new OleDbConnection(strCon);
myConn.Open();
string strSelet="select count(*) from cc_admin where usernam='"+textName1.Text+"' and passwor='"+textPass1.Text+"'";
OleDbCommand myCmd = new OleDbCommand(strSelet,myConn);
int Count=(int)myCmd.ExecuteScalar();
myConn.Close();
if(Count==0)
{
MessageBox.Show("没有!");
}
else
{
MessageBox.Show("有!");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,"提示!");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -