想实现.连接数据库,在DataGrid中显示出来的功能.
不知道错那了..主要程序..
this.dbConn.ConnectionString = "workstation id=TOTTI;packet size=4096;user id=sa;data source=TOTTI;persist securi" +"ty info=False;initial catalog=Tour DataBase";
private void sureButton_Click(object sender, System.EventArgs e)
{
dbConn.Open();//打开数据库连接
this.dbComm=new System.Data.SqlClient.SqlCommand(mySQL,dbConn);
this.dbAdap = new System.Data.SqlClient.SqlDataAdapter();
this.dbDS = new System.Data.DataSet();
dbAdap.SelectCommand=dbComm;
dbDS.Clear();
dbAdap.Fill(dbDS);
}
不知道错那了..主要程序..
this.dbConn.ConnectionString = "workstation id=TOTTI;packet size=4096;user id=sa;data source=TOTTI;persist securi" +"ty info=False;initial catalog=Tour DataBase";
private void sureButton_Click(object sender, System.EventArgs e)
{
dbConn.Open();//打开数据库连接
this.dbComm=new System.Data.SqlClient.SqlCommand(mySQL,dbConn);
this.dbAdap = new System.Data.SqlClient.SqlDataAdapter();
this.dbDS = new System.Data.DataSet();
dbAdap.SelectCommand=dbComm;
dbDS.Clear();
dbAdap.Fill(dbDS);
}
this.dbConn.ConnectionString = "Data Source=TOTTI;User ID=sa;Password=;Initial Catalog=Tour DataBase";
private void sureButton_Click(object sender, System.EventArgs e)
{
dbConn.Open();//打开数据库连接
this.dbAdap = new System.Data.SqlClient.SqlDataAdapter(mySQL,dbConn);
this.dbDS = new System.Data.DataSet();
dbAdap.Fill(dbDS);
}
this.dbConn=new System.Data.SqlClient.SqlConnection();
但是DATASET的数据 在DATAGRID中显示不出来...
DataGridCustomers.DataSource = dbDS ;
DataGridCustomers.DataBind();
windows 窗体中,没有这个方法撒........
SetDataBinding();