I create a simple data base table using Microfoft SQL Server 2005 and i want to display this simple table as a hole in my form.I use DataSet and DataAdapter to communicate with my SQL data base.i try to pull all the record at data base in to the DataSet by using the interface of DataAdapter,up to this i haven't any problem.My problem is to pull the record from the DataSet in to the Form or directly from the data base to a Form.
this is my code
System.Data.SqlClient.SqlConnection con;
DataSet ds;
System.Data.SqlClient.SqlDataAdapter da;
con = new System.Data.SqlClient.SqlConnection();
ds = new DataSet();
string sql = "SELECT* From Table1";
da = new System.Data.SqlClient.SqlDataAdapter(sql, con);
con.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database1.mdf;Integrated Security=True;User Instance=True";
con.Open();
da.Fill(ds, "Table1");
con.Close();
where "Table1" is the name of my table in the data base.
Thank you!
With best regards.