Nov 14, 2005 #1 PIAS Programmer Joined Nov 2, 2005 Messages 38 Location SI Hi! I'm a beginer in C# - making Web application. Can someone tell me how to connect GirdView with database? Thanks! PIAS
Hi! I'm a beginer in C# - making Web application. Can someone tell me how to connect GirdView with database? Thanks! PIAS
Nov 14, 2005 #2 misterstick Programmer Joined Apr 7, 2000 Messages 633 Location GB the simplest way is to connect to the database using the server explorer, then drag and drop the table or view into the form designer. this will create a connection and a dataadapter. right click on the dataadapter and select "create dataset" to create a strongly typed dataset. select the grid and in the properties window set the datasource and datamember properties to the dataset and table name respectively. the last step is to add the following code to the Form_Load event: Code: private void Form_Load(object sender, System.EventArgs e) { dataAdapter1.Fill(dataSet1, "TABLENAME"); } the names of the objects may vary depending on which connection you use. this isn't ideal but it should work. good luck. mr s. < Upvote 0 Downvote
the simplest way is to connect to the database using the server explorer, then drag and drop the table or view into the form designer. this will create a connection and a dataadapter. right click on the dataadapter and select "create dataset" to create a strongly typed dataset. select the grid and in the properties window set the datasource and datamember properties to the dataset and table name respectively. the last step is to add the following code to the Form_Load event: Code: private void Form_Load(object sender, System.EventArgs e) { dataAdapter1.Fill(dataSet1, "TABLENAME"); } the names of the objects may vary depending on which connection you use. this isn't ideal but it should work. good luck. mr s. <