📄 frmlong_kccx.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using _10901BS;
namespace _10901BS
{
public partial class frmlong_Kccx : Form
{
SqlConnection cn = new SqlConnection();
SqlCommand cm = new SqlCommand();
SqlDataAdapter da;
SqlCaoZuo ff = new SqlCaoZuo();
DataSet ee = new DataSet();
frmReport2 rpt2 = new frmReport2();
public static string str1;
public frmlong_Kccx()
{
InitializeComponent();
}
private void frmlong_Kccx_Load(object sender, EventArgs e)
{
this.txtrkDjID.Text = "";
this.txtrkSl.Text = "";
this.txtrkZje.Text = "";
this.txtspID.Text = "";
this.txtspName.Text = "";
this.spGgxh.Text = "";
this.txtjhDjID.Text = "";
this.tetKcsx.Text = "";
this.c.Text = "";
this.txtshKcSl.Text = "";
if (cn.State == ConnectionState.Closed)
{
cn.ConnectionString = "Data Source=.;Initial Catalog=110901db;Integrated Security=True";
cn.Open();
}
da = new SqlDataAdapter("select rkDjID as '入库编号',rkSl as '入库数量',rkZje as '入库总价格',rkxqBiao.spID as '商品编号',spName as '商品名称',spGgxh as '商品规格', jhDjID as '进货单据编号',spKcsx as '库存上线',spKcXX as '库存下线',shKcSl as'售后库存数量' from rkxqBiao,spxqBiao where rkxqBiao.spID=spxqBiao.spID", cn);
ee.Clear();
da.Fill(ee);
this.dataGridView1.DataSource = ee.Tables[0];
this.dataGridView1.Columns[0].Width = 120;
this.dataGridView1.Columns[1].Width = 120;
this.dataGridView1.Columns[2].Width = 120;
this.dataGridView1.Columns[3].Width = 120;
this.dataGridView1.Columns[4].Width = 120;
this.dataGridView1.Columns[5].Width = 120;
this.dataGridView1.Columns[6].Width = 120;
this.dataGridView1.Columns[7].Width = 120;
this.dataGridView1.Columns[8].Width = 120;
this.dataGridView1.Columns[9].Width = 120;
}
private void 查询_Click(object sender, EventArgs e)
{
ee.Clear();
da = new SqlDataAdapter("select rkDjID as '入库编号',rkSl as '入库数量',rkZje as '入库总价格',rkxqBiao.spID as '商品编号',spName as '商品名称',spGgxh as '商品规格',jhDjID as '进货单据编号',spKcsx as '库存上线',spKcXX as '库存下线',shKcSl as '售后库存数量' from rkxqBiao,spxqBiao where rkxqBiao.spID=spxqBiao.spID and spxqBiao.spName='"+txtspName.Text+"'", cn);
da.Fill(ee);
this.dataGridView1.DataSource = ee.Tables[0]; //绑定
}
private void 刷新_Click(object sender, EventArgs e)
{
frmlong_Kccx_Load(sender, e); //加载当前窗体
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
this.txtrkDjID.Text = this.dataGridView1.CurrentRow.Cells[0].Value.ToString();
this.txtrkSl.Text = this.dataGridView1.CurrentRow.Cells[1].Value.ToString();
this.txtrkZje.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
this.txtspID.Text = this.dataGridView1.CurrentRow.Cells[3].Value.ToString();
this.txtspName.Text = this.dataGridView1.CurrentRow.Cells[4].Value.ToString();
this.spGgxh.Text = this.dataGridView1.CurrentRow.Cells[5].Value.ToString();
this.txtjhDjID.Text = this.dataGridView1.CurrentRow.Cells[6].Value.ToString();
this.tetKcsx.Text = this.dataGridView1.CurrentRow.Cells[7].Value.ToString();
this.c.Text = this.dataGridView1.CurrentRow.Cells[8].Value.ToString();
this.txtshKcSl.Text = this.dataGridView1.CurrentRow.Cells[9].Value.ToString();
}
private void button3_Click(object sender, EventArgs e)
{
str1 = this.txtspName.Text;
rpt2.Show(); //秀出新窗体(视图)
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -