📄 selectsubject.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace 财务管理系统
{
/// <summary>
/// SelectSubject 的摘要说明。
/// </summary>
public class SelectSubject : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dataGrid1;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private 财务管理系统.DataSet1 dataSet11;
private System.Data.SqlClient.SqlConnection sqlConnection1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public SelectSubject()
{
//
// 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.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataSet11 = new 财务管理系统.DataSet1();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
this.dataGrid1.CaptionVisible = false;
this.dataGrid1.DataMember = "科目表";
this.dataGrid1.DataSource = this.dataSet11;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(0, 0);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ReadOnly = true;
this.dataGrid1.Size = new System.Drawing.Size(552, 408);
this.dataGrid1.TabIndex = 0;
this.dataGrid1.DoubleClick += new System.EventHandler(this.dataGrid1_DoubleClick);
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// 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("科目类别", "科目类别"),
new System.Data.Common.DataColumnMapping("是否存货科目", "是否存货科目"),
new System.Data.Common.DataColumnMapping("余额方向", "余额方向"),
new System.Data.Common.DataColumnMapping("数量单位", "数量单位")})});
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 科目代码, 科目名称, 助记码, 科目类别, 是否存货科目, 余额方向, 数量单位 FROM 科目表";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=localhost;packet size=4096;integrated security=SSPI;initial catalo" +
"g=caiwubook;persist security info=False";
//
// SelectSubject
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(552, 405);
this.Controls.Add(this.dataGrid1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "SelectSubject";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "双击表格前导航条选择科目";
this.Load += new System.EventHandler(this.SelectSubject_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void SelectSubject_Load(object sender, System.EventArgs e)
{
sqlDataAdapter1.Fill(dataSet11);
}
private void dataGrid1_DoubleClick(object sender, System.EventArgs e)
{
//向凭证输入窗体传递选择的科目编码和名称
WarrentInput.mID=dataGrid1[dataGrid1.CurrentCell.RowNumber,0].ToString();
WarrentInput.mName=dataGrid1[dataGrid1.CurrentCell.RowNumber,1].ToString();
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -