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

📄 queryform.cs

📁 一个很不错的学生成绩管理系统
💻 CS
📖 第 1 页 / 共 2 页
字号:
			// textBox6
			// 
			this.textBox6.Location = new System.Drawing.Point(328, 208);
			this.textBox6.Name = "textBox6";
			this.textBox6.Size = new System.Drawing.Size(80, 21);
			this.textBox6.TabIndex = 7;
			this.textBox6.Text = "textBox6";
			// 
			// textBox7
			// 
			this.textBox7.Location = new System.Drawing.Point(176, 256);
			this.textBox7.Name = "textBox7";
			this.textBox7.Size = new System.Drawing.Size(208, 21);
			this.textBox7.TabIndex = 8;
			this.textBox7.Text = "textBox7";
			// 
			// textBox8
			// 
			this.textBox8.Location = new System.Drawing.Point(176, 304);
			this.textBox8.Name = "textBox8";
			this.textBox8.Size = new System.Drawing.Size(208, 21);
			this.textBox8.TabIndex = 9;
			this.textBox8.Text = "textBox8";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(128, 160);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(48, 24);
			this.label3.TabIndex = 10;
			this.label3.Text = "姓名:";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(272, 160);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(48, 24);
			this.label4.TabIndex = 11;
			this.label4.Text = "学号:";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(128, 208);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(48, 24);
			this.label5.TabIndex = 12;
			this.label5.Text = "性别:";
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(272, 208);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(48, 24);
			this.label6.TabIndex = 13;
			this.label6.Text = "民族:";
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(128, 256);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(48, 24);
			this.label7.TabIndex = 14;
			this.label7.Text = "学院:";
			// 
			// label8
			// 
			this.label8.Location = new System.Drawing.Point(128, 304);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(48, 24);
			this.label8.TabIndex = 15;
			this.label8.Text = "专业:";
			// 
			// button3
			// 
			this.button3.Location = new System.Drawing.Point(160, 344);
			this.button3.Name = "button3";
			this.button3.Size = new System.Drawing.Size(64, 24);
			this.button3.TabIndex = 16;
			this.button3.Text = "关闭";
			this.button3.Click += new System.EventHandler(this.button3_Click);
			// 
			// sqlConnection1
			// 
			this.sqlConnection1.ConnectionString = "data source=COMPUTER-142;initial catalog=master;integrated security=SSPI;persist " +
				"security info=False;workstation id=COMPUTER-142;packet size=4096";
			// 
			// sqlCommand1
			// 
			this.sqlCommand1.Connection = this.sqlConnection1;
			this.sqlCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@姓名", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Output, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
			this.sqlCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@学号", System.Data.SqlDbType.Char, 10, System.Data.ParameterDirection.Output, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
			this.sqlCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@性别", System.Data.SqlDbType.Char, 10, System.Data.ParameterDirection.Output, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
			this.sqlCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@民族", System.Data.SqlDbType.Char, 10, System.Data.ParameterDirection.Output, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
			this.sqlCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@学院", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Output, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
			this.sqlCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@专业", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Output, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
			// 
			// sqlSelectCommand1
			// 
			this.sqlSelectCommand1.CommandText = "SELECT 学号, 姓名, 性别, 民族, 学院, 专业 FROM Students";
			this.sqlSelectCommand1.Connection = this.sqlConnection1;
			// 
			// sqlInsertCommand1
			// 
			this.sqlInsertCommand1.CommandText = "INSERT INTO Students(学号, 姓名, 性别, 民族, 学院, 专业) VALUES (@学号, @姓名, @性别, @民族, @学院, @专业" +
				"); SELECT 学号, 姓名, 性别, 民族, 学院, 专业 FROM Students 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, 50, "姓名"));
			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, 10, "民族"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@学院", System.Data.SqlDbType.VarChar, 50, "学院"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@专业", System.Data.SqlDbType.VarChar, 10, "专业"));
			// 
			// sqlUpdateCommand1
			// 
			this.sqlUpdateCommand1.CommandText = @"UPDATE Students SET 学号 = @学号, 姓名 = @姓名, 性别 = @性别, 民族 = @民族, 学院 = @学院, 专业 = @专业 WHERE (学号 = @Original_学号) AND (专业 = @Original_专业) AND (姓名 = @Original_姓名) AND (学院 = @Original_学院) AND (性别 = @Original_性别) AND (民族 = @Original_民族); SELECT 学号, 姓名, 性别, 民族, 学院, 专业 FROM Students 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, 50, "姓名"));
			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, 10, "民族"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@学院", System.Data.SqlDbType.VarChar, 50, "学院"));
			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, 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, 50, 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, 50, 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.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "民族", System.Data.DataRowVersion.Original, null));
			// 
			// sqlDeleteCommand1
			// 
			this.sqlDeleteCommand1.CommandText = "DELETE FROM Students WHERE (学号 = @Original_学号) AND (专业 = @Original_专业) AND (姓名 = " +
				"@Original_姓名) AND (学院 = @Original_学院) AND (性别 = @Original_性别) AND (民族 = @Origina" +
				"l_民族)";
			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, 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, 50, 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, 50, 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.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "民族", System.Data.DataRowVersion.Original, null));
			// 
			// 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", "Students", 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;
			// 
			// dataSet11
			// 
			this.dataSet11.DataSetName = "DataSet1";
			this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
			this.dataSet11.Namespace = "http://www.tempuri.org/DataSet1.xsd";
			// 
			// QueryForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(432, 389);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.button3,
																		  this.label8,
																		  this.label7,
																		  this.label6,
																		  this.label5,
																		  this.label4,
																		  this.label3,
																		  this.textBox8,
																		  this.textBox7,
																		  this.textBox6,
																		  this.textBox5,
																		  this.textBox4,
																		  this.textBox3,
																		  this.listBox1,
																		  this.groupBox1});
			this.Name = "QueryForm";
			this.Text = "QueryForm";
			this.groupBox1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void button2_Click(object sender, System.EventArgs e)
		{
			textBox1.Text="";
			textBox2.Text="";
		}

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

		private void button1_Click(object sender, System.EventArgs e)
		{
			try
			{
				sqlConnection1.Open();
				sqlCommand1=sqlConnection1.CreateCommand();
				
				if(radioButton1.Checked==true)
				{
					sqlCommand1.CommandText="SELECT @姓名,@学号,@性别,@民族,@学院,@专业 FROM Students WHERE 学号=@学号";
					sqlCommand1.Parameters.Add("@姓名",SqlDbType.VarChar,50);
					sqlCommand1.Parameters.Add("@学号",SqlDbType.Char,10);
					sqlCommand1.Parameters.Add("@性别",SqlDbType.Char,10);
					sqlCommand1.Parameters.Add("@民族",SqlDbType.Char,10);
					sqlCommand1.Parameters.Add("@学院",SqlDbType.VarChar,50);
					sqlCommand1.Parameters.Add("@专业",SqlDbType.VarChar,50);
					textBox1.Text=sqlCommand1.Parameters["@姓名"].Value.ToString();
					textBox2.Text=sqlCommand1.Parameters["@学号"].Value.ToString();
					textBox3.Text=sqlCommand1.Parameters["@性别"].Value.ToString();
					textBox4.Text=sqlCommand1.Parameters["@民族"].Value.ToString();
					textBox5.Text=sqlCommand1.Parameters["@学院"].Value.ToString();
					textBox6.Text=sqlCommand1.Parameters["@专业"].Value.ToString();
					sqlCommand1.ExecuteReader();
				}
			}
			catch(SqlException ex)
			{
				MessageBox.Show("Err:"+ex.ToString());
			}
			finally
			{
				sqlConnection1.Close();
			}
		}
	}
}

⌨️ 快捷键说明

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