📄 续证管理.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 续证管理 : Form
{
public 续证管理()
{
InitializeComponent();
}
private void 续证管理_Load(object sender, EventArgs e)
{
sqlDataAdapter1.Fill(dataSet91,"读者信息");
this.toolTip1.SetToolTip(this.textBox1,"根据查询字段设置查询值,此查询为精确查询!");
}
private void button1_Click(object sender, EventArgs e)
{
sqlConnection1.Open();
string str = "";
switch (comboBox1.SelectedIndex)
{
case 0:
str = "select * from 读者信息"; break;
case 1:
case 2:
str = "select * from 读者信息 where " + comboBox1.Text + "='" +textBox1.Text+ "'"; break;
default:
str = "select * from 读者信息"; break;
}
SqlDataAdapter myda = new SqlDataAdapter(str, sqlConnection1);
dataSet91.Clear();
myda.Fill(dataSet91, "读者信息");
sqlConnection1.Close();
}
private void button2_Click(object sender, EventArgs e)
{
sqlConnection1.Open();
SqlCommand mycom = new SqlCommand("update 读者信息 set 有限期至='"+textBox7.Text+"' where "+comboBox1.Text+"="+textBox1.Text.ToString().Trim(),sqlConnection1);
// mycom.ExecuteNonQuery();
int num = mycom.ExecuteNonQuery();
if (num == 1)
{
MessageBox.Show("更新成功!");
}
mycom.CommandText = "select * from 读者信息";
dataSet91.Clear();
SqlDataAdapter myda = new SqlDataAdapter();
myda.SelectCommand = mycom;
myda.Fill(dataSet91,"读者信息");
sqlConnection1.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -