📄 frmproductdate.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace 生产销售管理系统
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class FrmProductDate : System.Windows.Forms.Form
{
SqlDataAdapter da;
DataSet ds;
DataTable dtSource;
int PageCount;
int maxRec;
int pageSize;
int currentPage;
int recNo;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Splitter splitter1;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtPageSize;
private System.Windows.Forms.Button btnFillGrid;
private System.Windows.Forms.Button btnLastPage;
private System.Windows.Forms.Button btnPreviousPage;
private System.Windows.Forms.Button btnNextPage;
private System.Windows.Forms.Button btnFirstPage;
private System.Windows.Forms.Label txtDisplayPageNo;
private System.Windows.Forms.ToolTip toolTip1;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private System.ComponentModel.IContainer components;
public FrmProductDate()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.panel1 = new System.Windows.Forms.Panel();
this.txtDisplayPageNo = new System.Windows.Forms.Label();
this.txtPageSize = new System.Windows.Forms.TextBox();
this.btnFillGrid = new System.Windows.Forms.Button();
this.btnLastPage = new System.Windows.Forms.Button();
this.btnPreviousPage = new System.Windows.Forms.Button();
this.btnNextPage = new System.Windows.Forms.Button();
this.btnFirstPage = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.splitter1 = new System.Windows.Forms.Splitter();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.Controls.Add(this.txtDisplayPageNo);
this.panel1.Controls.Add(this.txtPageSize);
this.panel1.Controls.Add(this.btnFillGrid);
this.panel1.Controls.Add(this.btnLastPage);
this.panel1.Controls.Add(this.btnPreviousPage);
this.panel1.Controls.Add(this.btnNextPage);
this.panel1.Controls.Add(this.btnFirstPage);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.textBox1);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.comboBox1);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.button1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(680, 136);
this.panel1.TabIndex = 0;
//
// txtDisplayPageNo
//
this.txtDisplayPageNo.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.txtDisplayPageNo.Location = new System.Drawing.Point(152, 104);
this.txtDisplayPageNo.Name = "txtDisplayPageNo";
this.txtDisplayPageNo.Size = new System.Drawing.Size(112, 16);
this.txtDisplayPageNo.TabIndex = 15;
//
// txtPageSize
//
this.txtPageSize.Location = new System.Drawing.Point(88, 98);
this.txtPageSize.MaxLength = 5;
this.txtPageSize.Name = "txtPageSize";
this.txtPageSize.Size = new System.Drawing.Size(56, 21);
this.txtPageSize.TabIndex = 14;
this.txtPageSize.Text = "5";
this.toolTip1.SetToolTip(this.txtPageSize, "每页显示多少条数据");
//
// btnFillGrid
//
this.btnFillGrid.BackColor = System.Drawing.Color.LimeGreen;
this.btnFillGrid.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(192)), ((System.Byte)(192)));
this.btnFillGrid.Location = new System.Drawing.Point(8, 96);
this.btnFillGrid.Name = "btnFillGrid";
this.btnFillGrid.TabIndex = 12;
this.btnFillGrid.Text = "加载数据";
this.toolTip1.SetToolTip(this.btnFillGrid, "必须先加载数据");
this.btnFillGrid.Click += new System.EventHandler(this.btnFillGrid_Click);
//
// btnLastPage
//
this.btnLastPage.Enabled = false;
this.btnLastPage.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnLastPage.ForeColor = System.Drawing.Color.Green;
this.btnLastPage.Location = new System.Drawing.Point(574, 96);
this.btnLastPage.Name = "btnLastPage";
this.btnLastPage.Size = new System.Drawing.Size(97, 23);
this.btnLastPage.TabIndex = 11;
this.btnLastPage.Text = "最后页";
this.btnLastPage.Click += new System.EventHandler(this.btnLastPage_Click);
//
// btnPreviousPage
//
this.btnPreviousPage.Enabled = false;
this.btnPreviousPage.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnPreviousPage.ForeColor = System.Drawing.Color.Green;
this.btnPreviousPage.Location = new System.Drawing.Point(375, 96);
this.btnPreviousPage.Name = "btnPreviousPage";
this.btnPreviousPage.Size = new System.Drawing.Size(94, 23);
this.btnPreviousPage.TabIndex = 10;
this.btnPreviousPage.Text = "上一页";
this.btnPreviousPage.Click += new System.EventHandler(this.btnPreviousPage_Click);
//
// btnNextPage
//
this.btnNextPage.Enabled = false;
this.btnNextPage.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnNextPage.ForeColor = System.Drawing.Color.Green;
this.btnNextPage.Location = new System.Drawing.Point(476, 96);
this.btnNextPage.Name = "btnNextPage";
this.btnNextPage.Size = new System.Drawing.Size(91, 23);
this.btnNextPage.TabIndex = 9;
this.btnNextPage.Text = "下一页";
this.btnNextPage.Click += new System.EventHandler(this.btnNextPage_Click);
//
// btnFirstPage
//
this.btnFirstPage.Enabled = false;
this.btnFirstPage.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnFirstPage.ForeColor = System.Drawing.Color.Green;
this.btnFirstPage.Location = new System.Drawing.Point(272, 96);
this.btnFirstPage.Name = "btnFirstPage";
this.btnFirstPage.Size = new System.Drawing.Size(96, 23);
this.btnFirstPage.TabIndex = 8;
this.btnFirstPage.Text = "首页";
this.btnFirstPage.Click += new System.EventHandler(this.btnFirstPage_Click);
//
// label4
//
this.label4.Enabled = false;
this.label4.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label4.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.label4.Location = new System.Drawing.Point(8, 64);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(576, 16);
this.label4.TabIndex = 6;
this.label4.Text = "合计:";
//
// label3
//
this.label3.Enabled = false;
this.label3.Font = new System.Drawing.Font("宋体", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label3.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.label3.Location = new System.Drawing.Point(8, 40);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(576, 16);
this.label3.TabIndex = 5;
this.label3.Text = "条数:";
//
// textBox1
//
this.textBox1.Enabled = false;
this.textBox1.Location = new System.Drawing.Point(432, 8);
this.textBox1.MaxLength = 14;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(112, 21);
this.textBox1.TabIndex = 4;
this.textBox1.Text = "";
this.toolTip1.SetToolTip(this.textBox1, "输入物料编号");
//
// label2
//
this.label2.Enabled = false;
this.label2.Location = new System.Drawing.Point(360, 13);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 16);
this.label2.TabIndex = 3;
this.label2.Text = "产成品编号:";
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.Enabled = false;
this.comboBox1.Items.AddRange(new object[] {
"",
"1库",
"2库"});
this.comboBox1.Location = new System.Drawing.Point(168, 9);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(120, 20);
this.comboBox1.TabIndex = 2;
this.toolTip1.SetToolTip(this.comboBox1, "请选择仓库");
//
// label1
//
this.label1.Enabled = false;
this.label1.Location = new System.Drawing.Point(88, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 16);
this.label1.TabIndex = 1;
this.label1.Text = "选择仓库:";
//
// button1
//
this.button1.Enabled = false;
this.button1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.button1.ForeColor = System.Drawing.Color.Green;
this.button1.Location = new System.Drawing.Point(600, 8);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "开始查询";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// splitter1
//
this.splitter1.Dock = System.Windows.Forms.DockStyle.Top;
this.splitter1.Location = new System.Drawing.Point(0, 136);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(680, 3);
this.splitter1.TabIndex = 1;
this.splitter1.TabStop = false;
//
// dataGrid1
//
this.dataGrid1.CaptionVisible = false;
this.dataGrid1.DataMember = "";
this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(0, 139);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ReadOnly = true;
this.dataGrid1.Size = new System.Drawing.Size(680, 275);
this.dataGrid1.TabIndex = 2;
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "产成品库存", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("产成品编号", "产成品编号"),
new System.Data.Common.DataColumnMapping("仓库", "仓库"),
new System.Data.Common.DataColumnMapping("拼音编码", "拼音编码"),
new System.Data.Common.DataColumnMapping("产成品名", "产成品名"),
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -