📄 form_storage.cs
字号:
this.butLast.BackColor = System.Drawing.Color.Transparent;
this.butLast.Location = new System.Drawing.Point(308, 336);
this.butLast.Name = "butLast";
this.butLast.Size = new System.Drawing.Size(48, 24);
this.butLast.TabIndex = 36;
this.butLast.Text = ">|";
this.butLast.Click += new System.EventHandler(this.butLast_Click);
//
// butFirst
//
this.butFirst.BackColor = System.Drawing.Color.Transparent;
this.butFirst.Location = new System.Drawing.Point(164, 336);
this.butFirst.Name = "butFirst";
this.butFirst.Size = new System.Drawing.Size(48, 24);
this.butFirst.TabIndex = 35;
this.butFirst.Text = "|<";
this.butFirst.Click += new System.EventHandler(this.butFirst_Click);
//
// butNext
//
this.butNext.BackColor = System.Drawing.Color.Transparent;
this.butNext.Location = new System.Drawing.Point(260, 336);
this.butNext.Name = "butNext";
this.butNext.Size = new System.Drawing.Size(48, 24);
this.butNext.TabIndex = 34;
this.butNext.Text = ">";
this.butNext.Click += new System.EventHandler(this.butNext_Click);
//
// butPrev
//
this.butPrev.BackColor = System.Drawing.Color.Transparent;
this.butPrev.Location = new System.Drawing.Point(212, 336);
this.butPrev.Name = "butPrev";
this.butPrev.Size = new System.Drawing.Size(48, 24);
this.butPrev.TabIndex = 33;
this.butPrev.Text = "<";
this.butPrev.Click += new System.EventHandler(this.butPrev_Click);
//
// textForSearch
//
this.textForSearch.Location = new System.Drawing.Point(260, 295);
this.textForSearch.Name = "textForSearch";
this.textForSearch.Size = new System.Drawing.Size(96, 21);
this.textForSearch.TabIndex = 37;
this.textForSearch.Text = "";
//
// label8
//
this.label8.BackColor = System.Drawing.Color.Transparent;
this.label8.Location = new System.Drawing.Point(56, 295);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(64, 16);
this.label8.TabIndex = 38;
this.label8.Text = "查找方式";
//
// comboBox1
//
this.comboBox1.Items.AddRange(new object[] {
"图书名称",
"出版社"});
this.comboBox1.Location = new System.Drawing.Point(120, 295);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(72, 20);
this.comboBox1.TabIndex = 39;
this.comboBox1.Text = "图书名称";
//
// comboBox2
//
this.comboBox2.Items.AddRange(new object[] {
"模糊",
"精确"});
this.comboBox2.Location = new System.Drawing.Point(204, 295);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(48, 20);
this.comboBox2.TabIndex = 40;
this.comboBox2.Text = "模糊";
//
// bookpublishdate
//
this.bookpublishdate.Location = new System.Drawing.Point(164, 151);
this.bookpublishdate.Name = "bookpublishdate";
this.bookpublishdate.ReadOnly = true;
this.bookpublishdate.Size = new System.Drawing.Size(248, 21);
this.bookpublishdate.TabIndex = 42;
this.bookpublishdate.Text = "bookpublishdate";
//
// label9
//
this.label9.BackColor = System.Drawing.Color.Transparent;
this.label9.Location = new System.Drawing.Point(60, 151);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(72, 16);
this.label9.TabIndex = 41;
this.label9.Text = "出版日期";
//
// butShowAll
//
this.butShowAll.BackColor = System.Drawing.Color.Transparent;
this.butShowAll.Location = new System.Drawing.Point(104, 336);
this.butShowAll.Name = "butShowAll";
this.butShowAll.Size = new System.Drawing.Size(64, 24);
this.butShowAll.TabIndex = 43;
this.butShowAll.Text = "显示全部";
this.butShowAll.Click += new System.EventHandler(this.butShowAll_Click);
//
// Form_Storage
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(472, 382);
this.ControlBox = false;
this.Controls.Add(this.butShowAll);
this.Controls.Add(this.bookpublishdate);
this.Controls.Add(this.label9);
this.Controls.Add(this.comboBox2);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.label8);
this.Controls.Add(this.textForSearch);
this.Controls.Add(this.butLast);
this.Controls.Add(this.butFirst);
this.Controls.Add(this.butNext);
this.Controls.Add(this.butPrev);
this.Controls.Add(this.butSearch);
this.Controls.Add(this.pressname);
this.Controls.Add(this.bookinprice);
this.Controls.Add(this.bookquantity);
this.Controls.Add(this.bookname);
this.Controls.Add(this.bookISBN);
this.Controls.Add(this.bookinfo);
this.Controls.Add(this.bookoutprice);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Form_Storage";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Form_Storage";
this.Load += new System.EventHandler(this.Form_Storage_Load);
this.ResumeLayout(false);
}
#endregion
SQL sql;
public void show()
{
if(sql.rows.GetLength(0)!=0)
{
bookISBN.Text=sql.rows[sql.getPos(),0].ToString();
bookname.Text=sql.rows[sql.getPos(),1].ToString();
bookinfo.Text=sql.rows[sql.getPos(),2].ToString();
pressname.Text=sql.rows[sql.getPos(),3].ToString();
bookpublishdate.Text=sql.rows[sql.getPos(),4].ToString();
bookinprice.Text=sql.rows[sql.getPos(),5].ToString();
bookoutprice.Text=sql.rows[sql.getPos(),6].ToString();
bookquantity.Text=sql.rows[sql.getPos(),7].ToString();
}
else
{
bookISBN.Text="";
bookname.Text="";
bookinfo.Text="";
pressname.Text="";
bookpublishdate.Text="";
bookinprice.Text="";
bookoutprice.Text="";
bookquantity.Text="";
MessageBox.Show("无符合查询条件的结果!","提示");
}
}
private void Form_Storage_Load(object sender, System.EventArgs e)
{
sql=new SQL("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=图书管理系统数据库.mdb");
sql.ExecuteSQL("select * from 库存信息表 order by pressname,bookISBN");
show();
}
private void butFirst_Click(object sender, System.EventArgs e)
{
sql.pointToFirst();
show();
}
private void butPrev_Click(object sender, System.EventArgs e)
{
sql.pointToPrev();
show();
}
private void butNext_Click(object sender, System.EventArgs e)
{
sql.pointToNext();
show();
}
private void butLast_Click(object sender, System.EventArgs e)
{
sql.pointToLast();
show();
}
private void butSearch_Click(object sender, System.EventArgs e)
{
if(comboBox1.Text=="图书名称")
{
if(comboBox2.Text=="精确")
{
sql.ExecuteSQL("select * from 库存信息表 where bookname='"+textForSearch.Text+"' order by pressname,bookISBN");
show();
}
else
{
sql.ExecuteSQL("select * from 库存信息表 where bookname like '%"+textForSearch.Text+"%' order by pressname,bookISBN");
show();
}
}
else
{
if(comboBox2.Text=="精确")
{
sql.ExecuteSQL("select * from 库存信息表 where pressname='"+textForSearch.Text+"' order by pressname,bookISBN");
show();
}
else
{
sql.ExecuteSQL("select * from 库存信息表 where pressname like '%"+textForSearch.Text+"%' order by pressname,bookISBN");
show();
}
}
}
private void butShowAll_Click(object sender, System.EventArgs e)
{
sql.ExecuteSQL("select * from 库存信息表 order by pressname,bookISBN");
show();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -