C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...







Filling a DataSet with data from multiple tables


Posted Date: 29 Mar 2007    Resource Type: Code Snippets    Category: ADO.NET

Posted By: Mathews . T. Varghese       Member Level: Gold
Rating:     Points: 10



The following code shows how to fill a DataSet with data from multiple tables by using batch SQL statements.

The first table is named using the table name specified to the Fill method. Subsequent tables are named using the name specified to the Fill method and adding 1 for each table

SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Employees; SELECT * FROM Salary;", myConnection);
DataSet ds = new DataSet();
da.Fill(ds, "Employees");

The data from the Employees table is placed in a DataTable named "Employees". The data from the Salary table is placed in a DataTable named "Employees1".





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Binding data to a DataGrid
Previous Resource: Pass NULL as a Parameter Value to SQLParameter
Return to Discussion Resource Index
Post New Resource
Category: ADO.NET


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

online optimum rewards

Contact Us    Privacy Policy    Terms Of Use