📄 allusers.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>
/// Allusers 的摘要说明。
/// </summary>
public class Allusers : System.Windows.Forms.Form
{
private System.Windows.Forms.DataGrid dataGrid1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Allusers()
{
//
// 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();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// dataGrid1
//
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, 0);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.Size = new System.Drawing.Size(424, 350);
this.dataGrid1.TabIndex = 0;
//
// Allusers
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(424, 350);
this.Controls.Add(this.dataGrid1);
this.Name = "Allusers";
this.Text = "Allusers";
this.Load += new System.EventHandler(this.Allusers_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void Allusers_Load(object sender, System.EventArgs e)
{
string cmdSelect="SELECT *"+
"FROM users ,Borrower WHERE users.用户名=Borrower.用户名 ";
SqlDataAdapter myDataAdapter = new SqlDataAdapter();
DataSet myDataSet = new DataSet();
string strConn="INTEGRATED SECURITY=TRUE;Initial Catalog=Bookmanagement;Data Source=127.0.0.1";
SqlConnection myConnection=new SqlConnection(strConn);
myConnection.Open();
myDataAdapter.SelectCommand=new SqlCommand(cmdSelect,myConnection);
myDataSet.Clear();
myDataAdapter.Fill(myDataSet,"a");
dataGrid1.DataSource=myDataSet.Tables["a"];
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -