Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dataadapter insert
Message
From
04/02/2014 10:11:31
 
General information
Forum:
ASP.NET
Category:
Databases
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01584280
Message ID:
01593108
Views:
32
>>>Hi, Don,
>>>
>>>If you need to manually add rows to an ADO.NET data table, you need to use the ADO.NET object model.
>>>
>>>Here is a very simple example of an established DataTable with 2 columns for ID and Name...you'll need to adapt it to your application.
>>>
>>>This is basically an "untyped dataset" as opposed to a strongly typed dataset. Typed datasets are often better, but it's best to get the basics down first. Suppose your data table has 2 columns for ID and Name.
>>>
>>>
>>>DataRow dr = dt.NewRow();
>>> dr["ID"] = 1;
>>> dr["Name"] = "Kevin";
>>> dt.Rows.Add(dr);
>>>
>>>
>>>So if you need to add rows to a table before binding the ADO.NET datatable to a grid, that's a very simple example.
>>
>>Can dr be reused to add additional rows to the table, or do I need to create dr1, dr2, dr3, etc to add more rows? seems like the latter.
>
>You can re-use the same dr, e.g.
>
>
>DataRow dr = dt.NewRow();
>...
>
>dt.Rows.Add(dr);
>
>dr = dt.NewRow();
>...
>dt.Rows.Add(dr);
Thanks Naomi. I can't believe it's been since Sept. since I logged in here. Sorry for the delay.
Previous
Reply
Map
View

Click here to load this message in the networking platform