📄 pt_person_message.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;
using System.Configuration;
namespace CarManage
{
public partial class PT_Person_Message : Form
{
public PT_Person_Message()
{
InitializeComponent();
}
private void label19_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnCarCheck_Click(object sender, EventArgs e)
{
//cs_operate.U_name = UserName;
string CheckName = this.textCheckName.Text.ToString().Trim();
string sqlstr = "select pay_id as 序号,pay_account as 工人帐号,pay_kinds as 工种,pay_money as 工人工资,pay_ticket as 票款提成,pay_subsidy as 补助,pay_remark as 备注 from db_pay where 1 = 1";
//调用config配置文件对象dl连接对象
string dl = ConfigurationManager.AppSettings["sqlString"];
//创建connection对象con进行连接
SqlConnection con = new SqlConnection(dl);
//打开连接
con.Open();
if (CheckName != "")
{
sqlstr = sqlstr + "and pay_account = '" + CheckName + "'";
}
SqlCommand cmd = new SqlCommand(sqlstr, con);
//创建读取器对象sdr
SqlDataAdapter sdr = new SqlDataAdapter();
//sdr的查询方法为cmd
sdr.SelectCommand = cmd;
//创建一个dataset容器
DataSet ds = new DataSet();
//填充数据ds
sdr.Fill(ds);
//绑定datagriview数据源为ds
this.GridViewCarCheckResult.DataSource = ds.Tables[0].DefaultView;
//关闭连接
con.Close();
}
private void btnCarClear_Click(object sender, EventArgs e)
{
this.textCheckName.Clear();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -