Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 17th, 2003, 12:08 PM
Registered User
 
Join Date: Sep 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default .addnew for Ado.net?

I'm used to using the .addnew command for a recordset to add a new record to a database with the old ADO. Can you use .addnew with ADO.net? And if you can how do you use it? Or is there now a better way?

Thanks.
 
Old September 20th, 2003, 10:17 AM
Registered User
 
Join Date: Sep 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can use the NewRow() of the DataTable object. Here is a code snippet and C#
Code:
DataTable tbl = new DataTable("Person");
DataColumn col = tbl.Columns.Add("LastName", typeof(tring));
col.MaxLength = 25;
col.AllowDBNull = false;

// Insert a new row
DataRow row = tbl.NewRow();
row["LastName"] = "Walker";
tbl.Rows.Add(row);







Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between ADO and ADO.NET rakeshclose2u ADO.NET 2 April 23rd, 2007 03:57 AM
ADO AND ADO.NET royalsurej ADO.NET 1 November 8th, 2004 08:28 AM
VB/ADO: AddNew does NOT increment RecordCount msandid Pro VB Databases 3 August 2nd, 2004 04:42 AM
efficiency qn:ado .AddNew VS INSERT in stored proc ak Classic ASP Databases 1 February 25th, 2004 10:08 AM
effieciency: ado .AddNew vs Insert in Stored proc ak SQL Server ASP 2 February 25th, 2004 09:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.