⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 进入系统.cs

📁 atm取款机,源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
			// sqlDataAdapter1
			// 
			this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
			this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
			this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
			this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																									  new System.Data.Common.DataTableMapping("Table", "用户表", new System.Data.Common.DataColumnMapping[] {
																																																			 new System.Data.Common.DataColumnMapping("用户帐号", "用户帐号"),
																																																			 new System.Data.Common.DataColumnMapping("密码", "密码"),
																																																			 new System.Data.Common.DataColumnMapping("金额", "金额")})});
			this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
			// 
			// sqlDeleteCommand1
			// 
			this.sqlDeleteCommand1.CommandText = "DELETE FROM 用户表 WHERE (用户帐号 = @Original_用户帐号) AND (密码 = @Original_密码 OR @Original" +
				"_密码 IS NULL AND 密码 IS NULL) AND (金额 = @Original_金额 OR @Original_金额 IS NULL AND 金" +
				"额 IS NULL)";
			this.sqlDeleteCommand1.Connection = this.sqlConnection1;
			this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_用户帐号", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "用户帐号", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_密码", System.Data.SqlDbType.VarChar, 6, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "密码", System.Data.DataRowVersion.Original, null));
			this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_金额", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "金额", System.Data.DataRowVersion.Original, null));
			// 
			// sqlConnection1
			// 
			this.sqlConnection1.ConnectionString = "workstation id=\"MICROSOF-AC4FA8\";packet size=4096;integrated security=SSPI;data s" +
				"ource=\".\";persist security info=False;initial catalog=ATM取款机";
			// 
			// sqlInsertCommand1
			// 
			this.sqlInsertCommand1.CommandText = "INSERT INTO 用户表(用户帐号, 密码, 金额) VALUES (@用户帐号, @密码, @金额); SELECT 用户帐号, 密码, 金额 FROM " +
				"用户表 WHERE (用户帐号 = @用户帐号)";
			this.sqlInsertCommand1.Connection = this.sqlConnection1;
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@用户帐号", System.Data.SqlDbType.VarChar, 10, "用户帐号"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@密码", System.Data.SqlDbType.VarChar, 6, "密码"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@金额", System.Data.SqlDbType.VarChar, 10, "金额"));
			// 
			// sqlSelectCommand1
			// 
			this.sqlSelectCommand1.CommandText = "SELECT 用户帐号, 密码, 金额 FROM 用户表";
			this.sqlSelectCommand1.Connection = this.sqlConnection1;
			// 
			// sqlUpdateCommand1
			// 
			this.sqlUpdateCommand1.CommandText = "UPDATE 用户表 SET 用户帐号 = @用户帐号, 密码 = @密码, 金额 = @金额 WHERE (用户帐号 = @Original_用户帐号) AND" +
				" (密码 = @Original_密码 OR @Original_密码 IS NULL AND 密码 IS NULL) AND (金额 = @Original_" +
				"金额 OR @Original_金额 IS NULL AND 金额 IS NULL); SELECT 用户帐号, 密码, 金额 FROM 用户表 WHERE (" +
				"用户帐号 = @用户帐号)";
			this.sqlUpdateCommand1.Connection = this.sqlConnection1;
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@用户帐号", System.Data.SqlDbType.VarChar, 10, "用户帐号"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@密码", System.Data.SqlDbType.VarChar, 6, "密码"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@金额", System.Data.SqlDbType.VarChar, 10, "金额"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_用户帐号", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "用户帐号", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_密码", System.Data.SqlDbType.VarChar, 6, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "密码", System.Data.DataRowVersion.Original, null));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_金额", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "金额", System.Data.DataRowVersion.Original, null));
			// 
			// dataSet11
			// 
			this.dataSet11.DataSetName = "DataSet1";
			this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// label4
			// 
			this.label4.Enabled = false;
			this.label4.Location = new System.Drawing.Point(24, 16);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(56, 40);
			this.label4.TabIndex = 11;
			this.label4.Text = "label4";
			this.label4.Visible = false;
			// 
			// label5
			// 
			this.label5.Enabled = false;
			this.label5.Location = new System.Drawing.Point(96, 24);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(64, 32);
			this.label5.TabIndex = 12;
			this.label5.Text = "label5";
			this.label5.Visible = false;
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
			this.ClientSize = new System.Drawing.Size(1016, 734);
			this.Controls.Add(this.label5);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.textBox2);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.textBox1);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.label1);
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "Form1";
			this.Text = "进入系统";
			((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}
					
		
		private void button1_Click_1(object sender, System.EventArgs e)
		{ 
			
			if (textBox1.Text == "" || textBox2.Text == "")
			{
				MessageBox.Show("用户名或者密码不能为空!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				textBox1.Focus();
			}
			else
			{
				

				sqlConnection1.Open();
				string strin = "select * from 用户表 where 用户帐号='" + textBox1.Text.Trim() + "'and 密码='" + textBox2.Text.Trim() + "'";
				SqlCommand cmd=new SqlCommand(strin,sqlConnection1);
				SqlDataReader dr = cmd.ExecuteReader();
			
				if(dr.Read())
				{
					dr.Close();
					string strin2="select 金额,最大金额 from 用户表 where 用户帐号='" + textBox1.Text.Trim() + "'and 密码='" + textBox2.Text.Trim() + "'";
					SqlCommand cmd2=new SqlCommand(strin2,sqlConnection1);
					SqlDataReader dr2=cmd2.ExecuteReader();
					if(dr2.Read())
					{
						label4.Text=dr2.GetString(0).ToString();
						label5.Text=dr2.GetString(1).ToString();
						dr2.Close();
						int c;
						int d;
						c=int.Parse(label4.Text);
						d=int.Parse(label5.Text);
						if(c>0 && d>0)
						{
							kanum=textBox1.Text;
							Form2 frm =new Form2();
   						    frm.Show();
							this.Hide();
						}
						else

							MessageBox.Show("余额不足,或你今天已经取足了,不能再取!", "超支错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                       
                        
					}				
				}
				else
					MessageBox.Show("用户名或密码错误,请重新输入!!!");
				textBox1.Clear();
				    textBox2.Clear();
				    textBox1.Focus();
				sqlConnection1.Close();
			}
           
		}
		

		private void button2_Click_1(object sender, System.EventArgs e)
		{
		    this.Close();
		}


		
	}
}



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -