📄 form1.cs
字号:
//
this.btnnext.Location = new System.Drawing.Point(344, 120);
this.btnnext.Name = "btnnext";
this.btnnext.Size = new System.Drawing.Size(72, 23);
this.btnnext.TabIndex = 3;
this.btnnext.Text = "向下";
this.btnnext.Click += new System.EventHandler(this.btnnext_Click);
//
// btnupdata
//
this.btnupdata.Location = new System.Drawing.Point(360, 288);
this.btnupdata.Name = "btnupdata";
this.btnupdata.TabIndex = 4;
this.btnupdata.Text = "保存";
this.btnupdata.Click += new System.EventHandler(this.button3_Click);
//
// btnnewout
//
this.btnnewout.Location = new System.Drawing.Point(496, 240);
this.btnnewout.Name = "btnnewout";
this.btnnewout.TabIndex = 5;
this.btnnewout.Text = "销售";
this.btnnewout.Click += new System.EventHandler(this.btnnewout_Click);
//
// btnclose
//
this.btnclose.Location = new System.Drawing.Point(632, 296);
this.btnclose.Name = "btnclose";
this.btnclose.Size = new System.Drawing.Size(75, 32);
this.btnclose.TabIndex = 6;
this.btnclose.Text = "关闭";
this.btnclose.Click += new System.EventHandler(this.btnclose_Click);
//
// btnnewin
//
this.btnnewin.Location = new System.Drawing.Point(496, 280);
this.btnnewin.Name = "btnnewin";
this.btnnewin.TabIndex = 7;
this.btnnewin.Text = "进货";
this.btnnewin.Click += new System.EventHandler(this.btnnewin_Click);
//
// label1
//
this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.ForeColor = System.Drawing.Color.Blue;
this.label1.Location = new System.Drawing.Point(80, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(168, 24);
this.label1.TabIndex = 8;
this.label1.Text = "库 存";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// button1
//
this.button1.Location = new System.Drawing.Point(360, 208);
this.button1.Name = "button1";
this.button1.TabIndex = 9;
this.button1.Text = "删除";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// btnlast
//
this.btnlast.Location = new System.Drawing.Point(344, 160);
this.btnlast.Name = "btnlast";
this.btnlast.Size = new System.Drawing.Size(72, 23);
this.btnlast.TabIndex = 10;
this.btnlast.Text = "末行";
this.btnlast.Click += new System.EventHandler(this.btnlast_Click);
//
// btnfirst
//
this.btnfirst.Location = new System.Drawing.Point(344, 40);
this.btnfirst.Name = "btnfirst";
this.btnfirst.Size = new System.Drawing.Size(72, 23);
this.btnfirst.TabIndex = 11;
this.btnfirst.Text = "首行";
this.btnfirst.Click += new System.EventHandler(this.btnfirst_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", "good", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("goodid", "goodid"),
new System.Data.Common.DataColumnMapping("goodnm", "goodnm"),
new System.Data.Common.DataColumnMapping("goodprice", "goodprice"),
new System.Data.Common.DataColumnMapping("goodnum", "goodnum")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM good WHERE (goodid = @Original_goodid) AND (goodnm = @Original_goodnm OR @Original_goodnm IS NULL AND goodnm IS NULL) AND (goodnum = @Original_goodnum OR @Original_goodnum IS NULL AND goodnum IS NULL) AND (goodprice = @Original_goodprice OR @Original_goodprice IS NULL AND goodprice IS NULL)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_goodid", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "goodid", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_goodnm", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "goodnm", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_goodnum", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "goodnum", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_goodprice", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "goodprice", System.Data.DataRowVersion.Original, null));
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=HP110;packet size=4096;integrated security=SSPI;data source=\".\";pe" +
"rsist security info=False;initial catalog=sqlgoods";
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO good(goodid, goodnm, goodprice, goodnum) VALUES (@goodid, @goodnm, @g" +
"oodprice, @goodnum); SELECT goodid, goodnm, goodprice, goodnum FROM good WHERE (" +
"goodid = @goodid)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@goodid", System.Data.SqlDbType.Int, 4, "goodid"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@goodnm", System.Data.SqlDbType.VarChar, 50, "goodnm"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@goodprice", System.Data.SqlDbType.Money, 8, "goodprice"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@goodnum", System.Data.SqlDbType.Int, 4, "goodnum"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT goodid, goodnm, goodprice, goodnum FROM good";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE good SET goodid = @goodid, goodnm = @goodnm, goodprice = @goodprice, goodnum = @goodnum WHERE (goodid = @Original_goodid) AND (goodnm = @Original_goodnm OR @Original_goodnm IS NULL AND goodnm IS NULL) AND (goodnum = @Original_goodnum OR @Original_goodnum IS NULL AND goodnum IS NULL) AND (goodprice = @Original_goodprice OR @Original_goodprice IS NULL AND goodprice IS NULL); SELECT goodid, goodnm, goodprice, goodnum FROM good WHERE (goodid = @goodid)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@goodid", System.Data.SqlDbType.Int, 4, "goodid"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@goodnm", System.Data.SqlDbType.VarChar, 50, "goodnm"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@goodprice", System.Data.SqlDbType.Money, 8, "goodprice"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@goodnum", System.Data.SqlDbType.Int, 4, "goodnum"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_goodid", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "goodid", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_goodnm", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "goodnm", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_goodnum", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "goodnum", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_goodprice", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "goodprice", System.Data.DataRowVersion.Original, null));
//
// btnnew
//
this.btnnew.Location = new System.Drawing.Point(360, 248);
this.btnnew.Name = "btnnew";
this.btnnew.TabIndex = 12;
this.btnnew.Text = "更新";
this.btnnew.Click += new System.EventHandler(this.btnnew_Click);
//
// label2
//
this.label2.Location = new System.Drawing.Point(80, 336);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(224, 23);
this.label2.TabIndex = 13;
this.label2.Text = "进货价/商品列表价/销售价 均相差1元.";
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem3,
this.menuItem4,
this.menuItem5});
this.menuItem1.Text = "操作";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Text = "销售";
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
//
// menuItem3
//
this.menuItem3.Index = 1;
this.menuItem3.Text = "进货";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// menuItem4
//
this.menuItem4.Index = 2;
this.menuItem4.Text = "-";
//
// menuItem5
//
this.menuItem5.Index = 3;
this.menuItem5.Text = "关闭";
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.btnxearch);
this.groupBox2.Controls.Add(this.comboBox1);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.ForeColor = System.Drawing.Color.Blue;
this.groupBox2.Location = new System.Drawing.Point(656, 24);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(200, 184);
this.groupBox2.TabIndex = 14;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "商品查找";
//
// btnxearch
//
this.btnxearch.Location = new System.Drawing.Point(64, 128);
this.btnxearch.Name = "btnxearch";
this.btnxearch.TabIndex = 2;
this.btnxearch.Text = "查找";
this.btnxearch.Click += new System.EventHandler(this.btnxearch_Click);
//
// comboBox1
//
this.comboBox1.DataSource = this.dataSet11.good;
this.comboBox1.DisplayMember = "goodnm";
this.comboBox1.Location = new System.Drawing.Point(24, 72);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(160, 20);
this.comboBox1.TabIndex = 1;
//
// label3
//
this.label3.Location = new System.Drawing.Point(48, 40);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(104, 23);
this.label3.TabIndex = 0;
this.label3.Text = "输入要查找的商品";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(864, 370);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.label2);
this.Controls.Add(this.btnnew);
this.Controls.Add(this.btnfirst);
this.Controls.Add(this.btnlast);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnnewin);
this.Controls.Add(this.btnclose);
this.Controls.Add(this.btnnewout);
this.Controls.Add(this.btnupdata);
this.Controls.Add(this.btnnext);
this.Controls.Add(this.btnprev);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.dataGrid1);
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
private void Form1_Load(object sender, System.EventArgs e)
{
try
{
SqlCommand sqlcmd = new SqlCommand("getgoodinfo", sqlConnection1);
sqlcmd.CommandType = CommandType.StoredProcedure;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -