C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » Databases »

Inserting a Record in a table using ADO.NET Dataset


Posted Date: 20 Nov 2008    Resource Type: Articles    Category: Databases
Author: mahendrakiranMember Level: Gold    
Rating: 1 out of 5Points: 8



To insert a record in the data table, you create an object of the DataRow using the DataTable object. Then you set the appropriate field values and finally add it to the DataTable’s Rows collection.

The Following is the code written in C#.NET:

DataTable dt = ds.Tables["Article"];

// Insert
DataRow dr = dt.NewRow();
dr[0] = 4;
dr[1] = "MFC Programming";
dr[2] = "VC++ MFC Library";
dr[3] = 3;
dr[4] = 3000;
dr[5] = DateTime.Parse("20/11/2008");
dt.Rows.Add(dr);

da.Update(ds, "Article");
ds.AcceptChanges();



Responses


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

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add 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: Command Bulider Object prepares to update commands in Dataset
Previous Resource: Issues related to the deployment of data access application
Return to Discussion Resource Index
Post New Resource
Category: Databases


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use