Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GirdView - connection

Status
Not open for further replies.

PIAS

Programmer
Nov 2, 2005
38
SI
Hi!
I'm a beginer in C# - making Web application.
Can someone tell me how to connect GirdView with database?

Thanks!

PIAS
 
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. <;)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top