这是我写的一个程序,大家帮忙看看呀 using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Data.SqlClient;
namespace tongle { /// <summary> /// Form8 的摘要说明。 /// </summary> public class Form8 : System.Windows.Forms.Form { private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.DataGrid dataGrid1; private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.TabPage tabPage3; private System.Windows.Forms.TabPage tabPage4; private System.Windows.Forms.TabPage tabPage5; private System.Windows.Forms.Label label1; private System.Windows.Forms.RadioButton radioButton1; private System.Windows.Forms.RadioButton radioButton2; private System.Windows.Forms.RadioButton radioButton3; private System.Windows.Forms.RadioButton radioButton4; private System.Windows.Forms.Label label2; private System.Windows.Forms.Button button2; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Label label5; private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.Label label6; private System.Windows.Forms.TextBox textBox4; private System.Windows.Forms.Label label7; private System.Windows.Forms.TextBox textBox5; private System.Windows.Forms.Label label8; private System.Windows.Forms.TextBox textBox6; private System.Windows.Forms.Label label9; private System.Windows.Forms.TextBox textBox7; private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button4; private System.Windows.Forms.Label label10; private System.Windows.Forms.TextBox textBox8; private System.Windows.Forms.Button button5; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox textBox9; private System.Windows.Forms.Label label12; private System.Windows.Forms.TextBox textBox10; private System.Windows.Forms.Label label13; private System.Windows.Forms.TextBox textBox11; private System.Windows.Forms.Label label14; private System.Windows.Forms.TextBox textBox12; private System.Windows.Forms.Label label15; private System.Windows.Forms.TextBox textBox13; private System.Windows.Forms.Label label16; private System.Windows.Forms.TextBox textBox14; private System.Windows.Forms.Label label17; private System.Windows.Forms.TextBox textBox15; private System.Windows.Forms.Button button6; private BindingManagerBase Navigator; private System.Windows.Forms.Label label18; private System.Windows.Forms.TextBox textBox16; private System.Windows.Forms.Button button7; private System.Windows.Forms.Button button8; private System.Windows.Forms.Button button9; private System.Windows.Forms.Button button10; private System.Windows.Forms.Button button11; private System.Windows.Forms.Button button12; private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1; private System.Data.SqlClient.SqlCommand sqlSelectCommand1; private System.Data.SqlClient.SqlCommand sqlInsertCommand1; private System.Data.SqlClient.SqlCommand sqlUpdateCommand1; private System.Data.SqlClient.SqlCommand sqlDeleteCommand1; private System.Data.SqlClient.SqlConnection sqlConnection1; private tongle.DataSet1 dataSet11; private System.Data.SqlClient.SqlCommand sqlCommand1; /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null;
public Form8() { // // Windows 窗体设计器支持所必需的 // InitializeComponent();
// // TOD 在 InitializeComponent 调用后添加任何构造函数代码 // }
/// <summary> /// 清理所有正在使用的资源。 /// </summary> /// private void ExecuteSql(string StringSQL) { try { string MyConStr="server=Localhost;Integrated Security=SSPI;Initial Catalog=tongle"; sqlConnection1.ConnectionString=MyConStr; try { this.sqlCommand1.CommandText=StringSQL; this.sqlCommand1.CommandType= CommandType.Text; this.sqlCommand1.Connection=this.sqlConnection1; this.sqlConnection1.Open(); //sqlCommand1.CommandText="SELECT * from goods"; this.textBox16.Text=this.Navigator.Count.ToString(); this.sqlDataAdapter1.SelectCommand=sqlCommand1; this.dataSet11.Clear(); this.sqlDataAdapter1.Fill(this.dataSet11,"goods"); } catch(Exception ex) { MessageBox.Show(ex.Message,"错误!"); }; } finally { if(sqlConnection1.State==ConnectionState.Open) sqlConnection1.Close(); }
} protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); }
#region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.textBox16 = new System.Windows.Forms.TextBox(); this.label18 = new System.Windows.Forms.Label(); this.button4 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.button3 = new System.Windows.Forms.Button(); this.textBox7 = new System.Windows.Forms.TextBox(); this.label9 = new System.Windows.Forms.Label(); this.textBox6 = new System.Windows.Forms.TextBox(); this.label8 = new System.Windows.Forms.Label(); this.textBox5 = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.textBox4 = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.textBox3 = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.textBox2 = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.button12 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button(); this.button9 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); this.radioButton4 = new System.Windows.Forms.RadioButton(); this.radioButton3 = new System.Windows.Forms.RadioButton(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.tabPage4 = new System.Windows.Forms.TabPage(); this.button7 = new System.Windows.Forms.Button(); this.button5 = new System.Windows.Forms.Button(); this.textBox8 = new System.Windows.Forms.TextBox(); this.label10 = new System.Windows.Forms.Label(); this.tabPage5 = new System.Windows.Forms.TabPage(); this.button8 = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button(); this.textBox10 = new System.Windows.Forms.TextBox(); this.label13 = new System.Windows.Forms.Label(); this.textBox11 = new System.Windows.Forms.TextBox(); this.label14 = new System.Windows.Forms.Label(); this.textBox12 = new System.Windows.Forms.TextBox(); this.label15 = new System.Windows.Forms.Label(); this.textBox13 = new System.Windows.Forms.TextBox(); this.label16 = new System.Windows.Forms.Label(); this.textBox14 = new System.Windows.Forms.TextBox(); this.label17 = new System.Windows.Forms.Label(); this.textBox15 = new System.Windows.Forms.TextBox(); this.label12 = new System.Windows.Forms.Label(); this.textBox9 = new System.Windows.Forms.TextBox(); this.label11 = new System.Windows.Forms.Label(); this.dataGrid1 = new System.Windows.Forms.DataGrid(); this.dataSet11 = new tongle.DataSet1(); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlConnection1 = new System.Data.SqlClient.SqlConnection(); this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlCommand1 = new System.Data.SqlClient.SqlCommand(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage3.SuspendLayout(); this.tabPage2.SuspendLayout(); this.tabPage4.SuspendLayout(); this.tabPage5.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit(); this.SuspendLayout();