📄 sms_ingoodschk.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 FORU_SMS_
{
public partial class SMS_InGoodsChk : Form
{
BaseClass.DataConn Dconn = new FORU_SMS_.BaseClass.DataConn();
BaseClass.DataClass Dclass = new FORU_SMS_.BaseClass.DataClass();
DataSet ds;
public string sql = "";
public SMS_InGoodsChk()
{
InitializeComponent();
}
private void SMS_InGoodsChk_Load(object sender, EventArgs e)
{
dgvGInfo.Controls.Add(hScrollBar1);
sql = "SELECT GoodsID AS 货物编号, GoodsName AS 货物名称, SupName AS 仓库名称,StoreName AS 供应商名称, SpecName AS 货物规格,"
+ "UnitName AS 计量单位,GoodsNum AS 入库数量, GoodsPrice AS 货物单价, GoodsAPrice AS 进货总金额,GoodsTime AS 入库时间, GoodsPeople AS 经手人,"
+ "GoodsRemarks AS 备注 FROM SMS_Goods";
ds = Dclass.GetDataSet(sql, "SMS_Goods");
dgvGInfo.DataSource = ds.Tables[0];
}
private void btnLook_Click(object sender, EventArgs e)
{
string keyword = "";
string sqlCondition = "";
keyword = this.txtLKWord.Text.Trim();
if (this.cboxLCondition.Text.Trim() == "")
{
MessageBox.Show("请选择查询类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.cboxLCondition.Focus();
}
else if (keyword == "")
{
MessageBox.Show("请输入关键字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtLKWord.Focus();
}
else
{
try
{
switch (this.cboxLCondition.Text.Trim())
{
case "货物编号":
sqlCondition = sqlCondition + " where GoodsID='" + keyword + "'";
break;
case "货物名称":
sqlCondition = sqlCondition + " where GoodsName like '%" + keyword + "%'";
break;
case "仓库名称":
sqlCondition = sqlCondition + " where SupName='" + keyword + "'";
break;
}
ds = Dclass.GetDataSet(sql + sqlCondition, "SMS_Goods");
dgvGInfo.DataSource = ds.Tables[0];
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + sql, "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -