用户添加—检测.txt

来自「C#做的加密解密的东西」· 文本 代码 · 共 70 行

TXT
70
字号
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 + =
减小字号Ctrl + -
显示快捷键?