using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace sqlconnction
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button buttonBack;
private System.Windows.Forms.Button buttonNext;
private System.Windows.Forms.TextBox textName;
private System.Windows.Forms.Label labelName;
private System.Windows.Forms.TextBox textPassword;
private System.Windows.Forms.Label labelPassword;
private System.Windows.Forms.Button buttonFirst;
private System.Windows.Forms.Button buttonLast;
//定义全局变量
private DataSet myDataSet = null;
private System.Windows.Forms.Label label1;
private int i=0;
public DataSet MyDataSet
{
get
{ return myDataSet;}
set
{ myDataSet = ;}
}
//MS SQL数据库连接
private DataSet LoadDataSet()
{
SqlConnection con=new SqlConnection("server=.;uid=sa;pwd=sa;database=ex;");
con.Open();
SqlDataAdapter da=new SqlDataAdapter("select * from UserInfo",con);
DataSet ds=new DataSet();
da.Fill(ds,"UserInfo");
return ds;
}
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
Init();
//
// 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.buttonBack = new System.Windows.Forms.Button();
this.buttonNext = new System.Windows.Forms.Button();
this.textName = new System.Windows.Forms.TextBox();
this.labelName = new System.Windows.Forms.Label();
this.textPassword = new System.Windows.Forms.TextBox();
this.labelPassword = new System.Windows.Forms.Label();
this.buttonFirst = new System.Windows.Forms.Button();
this.buttonLast = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// buttonBack
//
this.buttonBack.Location = new System.Drawing.Point(64, 176);
this.buttonBack.Name = "buttonBack";
this.buttonBack.TabIndex = 0;