📄 form1.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace 读者类别设置
{
public partial class Form1 : Form
{
private BindingManagerBase aa;
public Form1()
{
InitializeComponent();
}
private void button10_Click(object sender, EventArgs e)
{
this.Close();
}
private void Form1_Load(object sender, EventArgs e)
{
sqlDataAdapter1.Fill(dataSet21,"读者信息");
aa = this.BindingContext[dataSet21, "读者信息"];
dataGrid1.SetDataBinding(dataSet21, "读者信息");
}
private void button1_Click(object sender, EventArgs e)
{
aa.Position = 0;
}
private void button4_Click(object sender, EventArgs e)
{
aa.Position = aa.Count - 1;
}
private void button2_Click(object sender, EventArgs e)
{
if (aa.Position == 0)
aa.Position = aa.Count - 1;
else
aa.Position = aa.Position - 1;
}
private void button3_Click(object sender, EventArgs e)
{
if (aa.Position == aa.Count - 1)
aa.Position = 0;
else
aa.Position = aa.Position + 1;
}
private void button5_Click(object sender, EventArgs e)
{
sqlConnection1.Open();
string str = "insert into 读者信息(条形码,编号,姓名,性别,类型,出生日期,有效证件,证件号码,联系方式,登记日期,有限期至,操作员,备注,图书借阅次数,期刊借阅次数) values('"+textBox4.Text+"','"+textBox5.Text+"','"+textBox6.Text+"','"+comboBox1.Items.ToString()+"','"+comboBox2.Items.ToString()+"',"+dateTimePicker1.Text+",'"+comboBox3.Items.ToString()+"','"+textBox8.Text+"','"+textBox7.Text+"',"+dateTimePicker2.Text+","+dateTimePicker3.Text+",'"+textBox11.Text+"','"+textBox12.Text+"',"+textBox9.Text+","+textBox10.Text+");select * from 读者信息";
SqlCommand mycom = new SqlCommand(str,sqlConnection1);
SqlDataAdapter myda= new SqlDataAdapter();
myda.SelectCommand = mycom;
dataSet21.Clear();
myda.Fill(dataSet21,"读者信息");
dataGrid1.SetDataBinding(dataSet21, "读者信息");
}
private void button12_Click(object sender, EventArgs e)
{
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
comboBox1.Text = "";
comboBox2.Text = "";
comboBox3.Text = "";
textBox7.Text = "";
textBox8.Text = "";
textBox9.Text = "";
textBox10.Text = "";
textBox11.Text = "";
textBox12.Text = "";
}
private void comboBox4_DropDown(object sender, EventArgs e)
{
timer1.ToString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -