📄 insert_jsbook.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Data.SqlClient;
namespace 图书
{
/// <summary>
/// insert_jsbook 的摘要说明。
/// </summary>
public class insert_jsbook : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Button btn_cancel;
private System.Windows.Forms.Button btn_sure;
private System.Windows.Forms.TextBox txt_yhrq;
private System.Windows.Forms.TextBox txt_jsrq;
private System.Windows.Forms.TextBox txt_jsbh;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txt_dzbh;
private System.Windows.Forms.Label lbl_lx;
private System.Windows.Forms.TextBox txt_bz;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public insert_jsbook()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label8 = new System.Windows.Forms.Label();
this.btn_cancel = new System.Windows.Forms.Button();
this.btn_sure = new System.Windows.Forms.Button();
this.txt_yhrq = new System.Windows.Forms.TextBox();
this.txt_jsrq = new System.Windows.Forms.TextBox();
this.txt_jsbh = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.txt_dzbh = new System.Windows.Forms.TextBox();
this.lbl_lx = new System.Windows.Forms.Label();
this.txt_bz = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label8
//
this.label8.Dock = System.Windows.Forms.DockStyle.Top;
this.label8.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label8.ForeColor = System.Drawing.Color.Blue;
this.label8.Location = new System.Drawing.Point(0, 0);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(496, 24);
this.label8.TabIndex = 76;
this.label8.Text = "借书信息添加";
this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.label8.Click += new System.EventHandler(this.label8_Click);
//
// btn_cancel
//
this.btn_cancel.BackColor = System.Drawing.Color.Silver;
this.btn_cancel.Location = new System.Drawing.Point(312, 264);
this.btn_cancel.Name = "btn_cancel";
this.btn_cancel.Size = new System.Drawing.Size(72, 24);
this.btn_cancel.TabIndex = 70;
this.btn_cancel.Text = "取消(&C)";
this.btn_cancel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.btn_cancel.Click += new System.EventHandler(this.btn_cancel_Click);
//
// btn_sure
//
this.btn_sure.BackColor = System.Drawing.Color.Silver;
this.btn_sure.Location = new System.Drawing.Point(136, 264);
this.btn_sure.Name = "btn_sure";
this.btn_sure.Size = new System.Drawing.Size(72, 23);
this.btn_sure.TabIndex = 68;
this.btn_sure.Text = "确定(&S)";
this.btn_sure.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.btn_sure.Click += new System.EventHandler(this.btn_sure_Click);
//
// txt_yhrq
//
this.txt_yhrq.Location = new System.Drawing.Point(360, 88);
this.txt_yhrq.Name = "txt_yhrq";
this.txt_yhrq.Size = new System.Drawing.Size(88, 21);
this.txt_yhrq.TabIndex = 95;
this.txt_yhrq.Text = "";
this.txt_yhrq.TextChanged += new System.EventHandler(this.txt_yhrq_TextChanged);
//
// txt_jsrq
//
this.txt_jsrq.Location = new System.Drawing.Point(136, 88);
this.txt_jsrq.Name = "txt_jsrq";
this.txt_jsrq.Size = new System.Drawing.Size(112, 21);
this.txt_jsrq.TabIndex = 94;
this.txt_jsrq.Text = "";
this.txt_jsrq.TextChanged += new System.EventHandler(this.txt_jsrq_TextChanged);
//
// txt_jsbh
//
this.txt_jsbh.Location = new System.Drawing.Point(136, 48);
this.txt_jsbh.Name = "txt_jsbh";
this.txt_jsbh.Size = new System.Drawing.Size(112, 21);
this.txt_jsbh.TabIndex = 91;
this.txt_jsbh.Text = "";
this.txt_jsbh.TextChanged += new System.EventHandler(this.txt_jsbh_TextChanged);
//
// label7
//
this.label7.Location = new System.Drawing.Point(88, 120);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(48, 32);
this.label7.TabIndex = 93;
this.label7.Text = "备注:";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label7.Click += new System.EventHandler(this.label7_Click);
//
// label5
//
this.label5.Location = new System.Drawing.Point(280, 88);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(72, 23);
this.label5.TabIndex = 92;
this.label5.Text = "应还日期:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label5.Click += new System.EventHandler(this.label5_Click);
//
// label6
//
this.label6.Location = new System.Drawing.Point(272, 48);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(80, 24);
this.label6.TabIndex = 90;
this.label6.Text = "读者编号:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label6.Click += new System.EventHandler(this.label6_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 48);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(112, 24);
this.label1.TabIndex = 89;
this.label1.Text = "书籍编号:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// txt_dzbh
//
this.txt_dzbh.Location = new System.Drawing.Point(360, 48);
this.txt_dzbh.Name = "txt_dzbh";
this.txt_dzbh.Size = new System.Drawing.Size(88, 21);
this.txt_dzbh.TabIndex = 98;
this.txt_dzbh.Text = "";
this.txt_dzbh.TextChanged += new System.EventHandler(this.txt_dzbh_TextChanged);
//
// lbl_lx
//
this.lbl_lx.Location = new System.Drawing.Point(56, 80);
this.lbl_lx.Name = "lbl_lx";
this.lbl_lx.Size = new System.Drawing.Size(80, 32);
this.lbl_lx.TabIndex = 97;
this.lbl_lx.Text = "借书日期:";
this.lbl_lx.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.lbl_lx.Click += new System.EventHandler(this.lbl_lx_Click);
//
// txt_bz
//
this.txt_bz.Location = new System.Drawing.Point(136, 128);
this.txt_bz.Multiline = true;
this.txt_bz.Name = "txt_bz";
this.txt_bz.Size = new System.Drawing.Size(288, 104);
this.txt_bz.TabIndex = 96;
this.txt_bz.Text = "";
this.txt_bz.TextChanged += new System.EventHandler(this.txt_bz_TextChanged);
//
// insert_jsbook
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(255)), ((System.Byte)(192)));
this.ClientSize = new System.Drawing.Size(496, 341);
this.Controls.Add(this.txt_yhrq);
this.Controls.Add(this.txt_jsrq);
this.Controls.Add(this.txt_jsbh);
this.Controls.Add(this.txt_dzbh);
this.Controls.Add(this.txt_bz);
this.Controls.Add(this.label7);
this.Controls.Add(this.label5);
this.Controls.Add(this.label6);
this.Controls.Add(this.label1);
this.Controls.Add(this.lbl_lx);
this.Controls.Add(this.label8);
this.Controls.Add(this.btn_cancel);
this.Controls.Add(this.btn_sure);
this.ForeColor = System.Drawing.Color.Blue;
this.Name = "insert_jsbook";
this.Text = "借书信息界面";
this.ResumeLayout(false);
}
#endregion
private void btn_sure_Click(object sender, System.EventArgs e)
{
int i=0;
StreamReader sr=new StreamReader("ts.ini",System.Text.Encoding.Default);
string sn=sr.ReadLine();
SqlConnection conn=new SqlConnection(sn);
SqlCommand comm=new SqlCommand("Insert_jsxxb",conn);
comm.CommandType=CommandType.StoredProcedure;
comm.Parameters.Add("@jsbh",(this.txt_jsbh.Text));
comm.Parameters.Add("@dzbh",(this.txt_dzbh.Text));
comm.Parameters.Add("@jsrq",(this.txt_jsrq.Text));
comm.Parameters.Add("@yhrq",(this.txt_yhrq.Text));
comm.Parameters.Add("@bz",(this.txt_bz.Text));
try
{
conn.Open();
i=comm.ExecuteNonQuery();
if(i==1)
{
MessageBox.Show("添加成功!");
this.Hide();
}
else
{
MessageBox.Show("已插入,不能再添加!");
}
}
catch
{
MessageBox.Show("添加失败!");
}
finally
{
conn.Close();
}
}
private void btn_cancel_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void label6_Click(object sender, System.EventArgs e)
{
}
private void label1_Click(object sender, System.EventArgs e)
{
}
private void txt_dzbh_TextChanged(object sender, System.EventArgs e)
{
}
private void lbl_lx_Click(object sender, System.EventArgs e)
{
}
private void txt_bz_TextChanged(object sender, System.EventArgs e)
{
}
private void label8_Click(object sender, System.EventArgs e)
{
}
private void txt_yhrq_TextChanged(object sender, System.EventArgs e)
{
}
private void txt_jsrq_TextChanged(object sender, System.EventArgs e)
{
}
private void txt_jsbh_TextChanged(object sender, System.EventArgs e)
{
}
private void label7_Click(object sender, System.EventArgs e)
{
}
private void label5_Click(object sender, System.EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -