?? updatef.cs
字號:
this.tabPage3.Controls.Add(this.label14);
this.tabPage3.Controls.Add(this.label13);
this.tabPage3.Controls.Add(this.label12);
this.tabPage3.Controls.Add(this.label11);
this.tabPage3.Controls.Add(this.textBox14);
this.tabPage3.Controls.Add(this.textBox13);
this.tabPage3.Controls.Add(this.textBox12);
this.tabPage3.Controls.Add(this.textBox11);
this.tabPage3.Location = new System.Drawing.Point(4, 21);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(336, 263);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "修改借閱信息";
//
// textBox24
//
this.textBox24.Location = new System.Drawing.Point(232, 144);
this.textBox24.Name = "textBox24";
this.textBox24.Size = new System.Drawing.Size(64, 21);
this.textBox24.TabIndex = 14;
this.textBox24.Text = "textBox24";
//
// textBox23
//
this.textBox23.Location = new System.Drawing.Point(168, 144);
this.textBox23.Name = "textBox23";
this.textBox23.Size = new System.Drawing.Size(56, 21);
this.textBox23.TabIndex = 13;
this.textBox23.Text = "textBox23";
//
// textBox22
//
this.textBox22.Location = new System.Drawing.Point(96, 144);
this.textBox22.Name = "textBox22";
this.textBox22.Size = new System.Drawing.Size(64, 21);
this.textBox22.TabIndex = 12;
this.textBox22.Text = "textBox22";
//
// textBox21
//
this.textBox21.Location = new System.Drawing.Point(232, 104);
this.textBox21.Name = "textBox21";
this.textBox21.Size = new System.Drawing.Size(64, 21);
this.textBox21.TabIndex = 11;
this.textBox21.Text = "textBox21";
//
// label19
//
this.label19.Location = new System.Drawing.Point(40, 232);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(248, 23);
this.label19.TabIndex = 10;
this.label19.Text = "*本頁面只能對后兩項修改,前兩項用于查詢";
//
// button6
//
this.button6.Location = new System.Drawing.Point(192, 192);
this.button6.Name = "button6";
this.button6.TabIndex = 9;
this.button6.Text = "取消";
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(48, 192);
this.button5.Name = "button5";
this.button5.TabIndex = 8;
this.button5.Text = "更新";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// label14
//
this.label14.Location = new System.Drawing.Point(40, 152);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(48, 23);
this.label14.TabIndex = 7;
this.label14.Text = "還期:";
//
// label13
//
this.label13.Location = new System.Drawing.Point(40, 104);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(48, 23);
this.label13.TabIndex = 6;
this.label13.Text = "借期:";
//
// label12
//
this.label12.Location = new System.Drawing.Point(40, 64);
this.label12.Name = "label12";
this.label12.TabIndex = 5;
this.label12.Text = "圖書編號:";
//
// label11
//
this.label11.Location = new System.Drawing.Point(40, 24);
this.label11.Name = "label11";
this.label11.TabIndex = 4;
this.label11.Text = "讀者編號:";
//
// textBox14
//
this.textBox14.Location = new System.Drawing.Point(168, 104);
this.textBox14.Name = "textBox14";
this.textBox14.Size = new System.Drawing.Size(56, 21);
this.textBox14.TabIndex = 3;
this.textBox14.Text = "textBox14";
//
// textBox13
//
this.textBox13.Location = new System.Drawing.Point(96, 104);
this.textBox13.Name = "textBox13";
this.textBox13.Size = new System.Drawing.Size(64, 21);
this.textBox13.TabIndex = 2;
this.textBox13.Text = "textBox13";
//
// textBox12
//
this.textBox12.Location = new System.Drawing.Point(192, 64);
this.textBox12.Name = "textBox12";
this.textBox12.TabIndex = 1;
this.textBox12.Text = "textBox12";
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(192, 24);
this.textBox11.Name = "textBox11";
this.textBox11.TabIndex = 0;
this.textBox11.Text = "textBox11";
//
// tabPage4
//
this.tabPage4.Controls.Add(this.button8);
this.tabPage4.Controls.Add(this.button7);
this.tabPage4.Controls.Add(this.label18);
this.tabPage4.Controls.Add(this.label17);
this.tabPage4.Controls.Add(this.label16);
this.tabPage4.Controls.Add(this.label15);
this.tabPage4.Controls.Add(this.textBox18);
this.tabPage4.Controls.Add(this.textBox17);
this.tabPage4.Controls.Add(this.textBox16);
this.tabPage4.Controls.Add(this.textBox15);
this.tabPage4.Location = new System.Drawing.Point(4, 21);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(336, 263);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "修改讀者類型";
//
// button8
//
this.button8.Location = new System.Drawing.Point(192, 208);
this.button8.Name = "button8";
this.button8.TabIndex = 9;
this.button8.Text = "取消";
this.button8.Click += new System.EventHandler(this.button8_Click);
//
// button7
//
this.button7.Location = new System.Drawing.Point(56, 208);
this.button7.Name = "button7";
this.button7.TabIndex = 8;
this.button7.Text = "更新";
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// label18
//
this.label18.Location = new System.Drawing.Point(40, 152);
this.label18.Name = "label18";
this.label18.TabIndex = 7;
this.label18.Text = "借閱期限:";
//
// label17
//
this.label17.Location = new System.Drawing.Point(40, 104);
this.label17.Name = "label17";
this.label17.TabIndex = 6;
this.label17.Text = "限借閱數量:";
//
// label16
//
this.label16.Location = new System.Drawing.Point(40, 64);
this.label16.Name = "label16";
this.label16.TabIndex = 5;
this.label16.Text = "類型名稱:";
//
// label15
//
this.label15.Location = new System.Drawing.Point(40, 24);
this.label15.Name = "label15";
this.label15.TabIndex = 4;
this.label15.Text = "類型編號:";
//
// textBox18
//
this.textBox18.Location = new System.Drawing.Point(176, 152);
this.textBox18.Name = "textBox18";
this.textBox18.TabIndex = 3;
this.textBox18.Text = "textBox18";
//
// textBox17
//
this.textBox17.Location = new System.Drawing.Point(176, 104);
this.textBox17.Name = "textBox17";
this.textBox17.TabIndex = 2;
this.textBox17.Text = "textBox17";
//
// textBox16
//
this.textBox16.Location = new System.Drawing.Point(176, 64);
this.textBox16.Name = "textBox16";
this.textBox16.TabIndex = 1;
this.textBox16.Text = "textBox16";
//
// textBox15
//
this.textBox15.Location = new System.Drawing.Point(176, 24);
this.textBox15.Name = "textBox15";
this.textBox15.TabIndex = 0;
this.textBox15.Text = "textBox15";
//
// UpdateF
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(376, 325);
this.Controls.Add(this.tabControl1);
this.Name = "UpdateF";
this.Text = "UpdateF";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.tabPage4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void textBox2_TextChanged(object sender, System.EventArgs e)
{
}
private void button1_Click(object sender, System.EventArgs e)
{//修改讀者信息表
string no=textBox1.Text;//讀者編號
string name=textBox2.Text;//姓名
string TypeNo=textBox3.Text;//類型編號
string yjsl=textBox4.Text;//已借數量
try
{
int yjs=int.Parse(yjsl);
string sql="select * from Reader where Rid='"+no+"'";
if(util.isExist(sql))
{
string sql1="update Reader set Rname='"+name+"',Rtypeno='"+TypeNo+"',Rgetnum="+yjsl+" where Rid='"+no+"'";
int m=sq.Update(sql1);
if(m==0)
{
MessageBox.Show("發生錯誤,修改未成功!!");
}
else
{
MessageBox.Show("ok!! 修改成功!!");
}
}
else{
MessageBox.Show("數據庫里沒有該編號的讀者,無法更新!!");
}
}
catch(Exception em8){
MessageBox.Show("請保證每空都是正確的格式!!");
}
}
private void button2_Click(object sender, System.EventArgs e)
{
textBox1.Clear();
textBox2.Clear();
textBox3.Clear();
textBox4.Clear();
}
private void button3_Click(object sender, System.EventArgs e)
{//圖書信息表
string bno=textBox5.Text;
string bname=textBox6.Text;
string bprice=textBox7.Text;
string bcount=textBox8.Text;
string bp=textBox9.Text;//出版社
string bpdate1=textBox10.Text;
string bpdate2=textBox19.Text;
string bpdate3=textBox20.Text;
try
{
int bpr=int.Parse(bprice);
int bnum=int.Parse(bcount);
int bpd1=int.Parse(bpdate1);
int bpd2=int.Parse(bpdate2);
int bpd3=int.Parse(bpdate3);
DateTime date=new DateTime(bpd1,bpd2,bpd3);
string sql="select * from Book where Bid='"+bno+"'";
if(util.isExist(sql))
{
string sql1="update Book set Bname='"+bname+"',Bprice="+bpr+",Bnum="+bnum+" ,Bpublish='"+bp+"',Bdate='"+date+"' where Bid='"+bno+"'";
int m=sq.Update(sql1);
if(m==0)
{
MessageBox.Show("發生錯誤,修改未成功!!");
}
else
{
MessageBox.Show("ok!! 修改成功!!");
}
}
else
{
MessageBox.Show("數據庫里沒有該編號的圖書,無法更新!!");
}
}
catch(Exception em6){
MessageBox.Show("請保證每空都是正確的格式!!");
}
}
private void button4_Click(object sender, System.EventArgs e)
{
textBox5.Clear();
textBox6.Clear();
textBox7.Clear();
textBox8.Clear();
textBox9.Clear();
textBox10.Clear();
textBox19.Clear();
textBox20.Clear();
}
private void button5_Click(object sender, System.EventArgs e)
{//借閱信息表
string rid=textBox11.Text;//讀者編號
string bid=textBox12.Text;//圖書編號
string jieq1=textBox13.Text;
string jieq2=textBox14.Text;
string jieq3=textBox21.Text;
string haiq1=textBox22.Text;
string haiq2=textBox23.Text;
string haiq3=textBox24.Text;
int jq1,jq2,jq3,hq1,hq2,hq3;
try
{
jq1=int.Parse(jieq1);
jq2=int.Parse(jieq2);
jq3=int.Parse(jieq3);
hq1=int.Parse(haiq1);
hq2=int.Parse(haiq2);
hq3=int.Parse(haiq3);
DateTime gdate=new DateTime(jq1,jq2,jq3);
DateTime sdate=new DateTime(hq1,hq2,hq3);
string sql="select * from GetBInfo where Rid='"+rid+"' and Bid='"+bid+"'";
//string sql="select * from Reader where Rid='"+no+"'";
if(util.isExist(sql))
{
string sql1="update GetBInfo set Getdate='"+gdate+"',Setdate='"+sdate+"' where Rid='"+rid+"' and Bid='"+bid+"'";
int m=sq.Update(sql1);
if(m==0)
{
MessageBox.Show("發生錯誤,修改未成功!!");
}
else
{
MessageBox.Show("ok!! 修改成功!!");
}
}
else
{
MessageBox.Show("數據庫里沒有該讀者借該圖書,無法更新!!");
}
}
catch(Exception em9){
MessageBox.Show("請保證每空都是正確的格式!!");
}
}
private void button7_Click(object sender, System.EventArgs e)
{//讀者類型對照表
string TypeNo=textBox15.Text; //類型編號
string TypeName=textBox16.Text;//類型名稱
string Ynum=textBox17.Text;//限借閱數量
string jdate=textBox18.Text;//借閱期限
try
{
int yn=int.Parse(Ynum);
int jd=int.Parse(jdate);
string sql="select * from ReaderType where Typeid='"+TypeNo+"'";
if(util.isExist(sql))
{
string sql1="update ReaderType set Typename='"+TypeName+"',Getmaxnum="+yn+",Getmaxday="+jd+" where Typeid='"+TypeNo+"'";
int m=sq.Update(sql1);
if(m==0)
{
MessageBox.Show("發生錯誤,修改未成功!!");
}
else
{
MessageBox.Show("ok!! 修改成功!!");
}
}
else
{
MessageBox.Show("數據庫里沒有該編號的讀者類型,無法更新!!");
}
}
catch(Exception em5){
MessageBox.Show("請保證每空都是正確的格式!!");
}
}
private void button8_Click(object sender, System.EventArgs e)
{
textBox15.Clear();
textBox16.Clear();
textBox17.Clear();
textBox18.Clear();
}
private void button6_Click(object sender, System.EventArgs e)
{
textBox11.Clear();
textBox12.Clear();
textBox13.Clear();
textBox14.Clear();
textBox21.Clear();
textBox22.Clear();
textBox23.Clear();
textBox24.Clear();
}
private void tabPage1_Click(object sender, System.EventArgs e)
{
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -