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

📄 form2.cs

📁 学生信息管理系统
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.返回.TabIndex = 17;
			this.返回.Text = "关闭";
			this.返回.Click += new System.EventHandler(this.关闭_Click);
			// 
			// 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", "student", new System.Data.Common.DataColumnMapping[] {
																																																				 new System.Data.Common.DataColumnMapping("学号", "学号"),
																																																				 new System.Data.Common.DataColumnMapping("姓名", "姓名"),
																																																				 new System.Data.Common.DataColumnMapping("专业名", "专业名"),
																																																				 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 student WHERE (学号 = @Original_学号) AND (专业名 = @Original_专业名) AND (出生时间" +
				" = @Original_出生时间) AND (姓名 = @Original_姓名) AND (性别 = @Original_性别) AND (总学分 = @O" +
				"riginal_总学分 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, 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));
			this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_出生时间", System.Data.SqlDbType.DateTime, 4, 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, 8, 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.Bit, 1, 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.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "总学分", System.Data.DataRowVersion.Original, null));
			// 
			// sqlConnection1
			// 
			this.sqlConnection1.ConnectionString = "workstation id=8FB25E96FF90450;packet size=4096;integrated security=SSPI;data sou" +
				"rce=8FB25E96FF90450;persist security info=False;initial catalog=celery";
			// 
			// sqlInsertCommand1
			// 
			this.sqlInsertCommand1.CommandText = "INSERT INTO student(学号, 姓名, 专业名, 性别, 出生时间, 总学分, 备注) VALUES (@学号, @姓名, @专业名, @性别, " +
				"@出生时间, @总学分, @备注); SELECT 学号, 姓名, 专业名, 性别, 出生时间, 总学分, 备注 FROM student WHERE (学号 " +
				"= @学号)";
			this.sqlInsertCommand1.Connection = this.sqlConnection1;
			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, 8, "姓名"));
			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.Bit, 1, "性别"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@出生时间", System.Data.SqlDbType.DateTime, 4, "出生时间"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@总学分", System.Data.SqlDbType.TinyInt, 1, "总学分"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@备注", System.Data.SqlDbType.VarChar, 2147483647, "备注"));
			// 
			// sqlSelectCommand1
			// 
			this.sqlSelectCommand1.CommandText = "SELECT 学号, 姓名, 专业名, 性别, 出生时间, 总学分, 备注 FROM student";
			this.sqlSelectCommand1.Connection = this.sqlConnection1;
			// 
			// sqlUpdateCommand1
			// 
			this.sqlUpdateCommand1.CommandText = @"UPDATE student SET 学号 = @学号, 姓名 = @姓名, 专业名 = @专业名, 性别 = @性别, 出生时间 = @出生时间, 总学分 = @总学分, 备注 = @备注 WHERE (学号 = @Original_学号) AND (专业名 = @Original_专业名) AND (出生时间 = @Original_出生时间) AND (姓名 = @Original_姓名) AND (性别 = @Original_性别) AND (总学分 = @Original_总学分 OR @Original_总学分 IS NULL AND 总学分 IS NULL); SELECT 学号, 姓名, 专业名, 性别, 出生时间, 总学分, 备注 FROM student WHERE (学号 = @学号)";
			this.sqlUpdateCommand1.Connection = this.sqlConnection1;
			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, 8, "姓名"));
			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.Bit, 1, "性别"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@出生时间", System.Data.SqlDbType.DateTime, 4, "出生时间"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@总学分", System.Data.SqlDbType.TinyInt, 1, "总学分"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@备注", System.Data.SqlDbType.VarChar, 2147483647, "备注"));
			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));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_出生时间", System.Data.SqlDbType.DateTime, 4, 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, 8, 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.Bit, 1, 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.TinyInt, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "总学分", System.Data.DataRowVersion.Original, null));
			// 
			// radioButton1
			// 
			this.radioButton1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "student.性别"));
			this.radioButton1.Location = new System.Drawing.Point(344, 56);
			this.radioButton1.Name = "radioButton1";
			this.radioButton1.Size = new System.Drawing.Size(32, 24);
			this.radioButton1.TabIndex = 21;
			this.radioButton1.Text = "男";
			// 
			// radioButton2
			// 
			this.radioButton2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "student.性别"));
			this.radioButton2.Location = new System.Drawing.Point(416, 56);
			this.radioButton2.Name = "radioButton2";
			this.radioButton2.Size = new System.Drawing.Size(32, 24);
			this.radioButton2.TabIndex = 22;
			this.radioButton2.Text = "女";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(480, 32);
			this.label1.TabIndex = 23;
			this.label1.Text = "插入记录";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// dataGrid1
			// 
			this.dataGrid1.DataMember = "";
			this.dataGrid1.DataSource = this.dataSet11.student;
			this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid1.Location = new System.Drawing.Point(8, 240);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.Size = new System.Drawing.Size(480, 144);
			this.dataGrid1.TabIndex = 24;
			// 
			// Form2
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(496, 389);
			this.Controls.Add(this.dataGrid1);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.radioButton2);
			this.Controls.Add(this.radioButton1);
			this.Controls.Add(this.返回);
			this.Controls.Add(this.insert);
			this.Controls.Add(this.all);
			this.Controls.Add(this.birthday);
			this.Controls.Add(this.memory);
			this.Controls.Add(this.department);
			this.Controls.Add(this.sname);
			this.Controls.Add(this.sno);
			this.Controls.Add(this.总学分);
			this.Controls.Add(this.出生日期);
			this.Controls.Add(this.性别);
			this.Controls.Add(this.备注);
			this.Controls.Add(this.专业名);
			this.Controls.Add(this.姓名);
			this.Controls.Add(this.学号);
			this.Name = "Form2";
			this.Text = "插入记录";
			this.Load += new System.EventHandler(this.Form2_Load);
			((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion
		private void 出生日期_Click(object sender, System.EventArgs e)
		{
		
		}

		private void Form2_Load(object sender, System.EventArgs e)
		{
//		   sqlDataAdapter1.Fill(dataSet11);
		}

		private void 专业名_Click(object sender, System.EventArgs e)
		{
		
		}

		private void 姓名_Click(object sender, System.EventArgs e)
		{
		
		}

		private void textBox4_TextChanged(object sender, System.EventArgs e)
		{
		   
		}

	

		private void textBox1_TextChanged(object sender, System.EventArgs e)
		{
		  
		}

		private void insert_Click(object sender, System.EventArgs e)
		{
			
			try
			{   
			    bool sex;
			    DataRow add;
				add=dataSet11.Tables["student"].NewRow();
				add[0]=sno.Text;
				add[1]=sname.Text;
				add[2]=department.Text;

				if(radioButton1.Checked==true)
				  {	
					sex=true;
				    add[3]=sex;
				 }

				else
				  { 
					sex=false;
					add[3]=sex;
				  }
				
			
				add[4]=Convert.ToDateTime(birthday.Text);
				add[5]=all.Text;
				add[6]=memory.Text;

				dataSet11.Tables["student"].Rows.Add(add);
				sqlDataAdapter1.Update(dataSet11,"student");
				
				
            

			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}
			
			
		     




		private void radioButton1_CheckedChanged(object sender, System.EventArgs e)
		{
			
		}

		private void birthday_TextChanged(object sender, System.EventArgs e)
		{
		
		}

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

		private void radioButton2_CheckedChanged(object sender, System.EventArgs e)
		{  
			
			
			
		} 

	
	
	}
}

⌨️ 快捷键说明

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