|
Subject:
|
.addnew for Ado.net?
|
|
Posted By:
|
paulwalker
|
Post Date:
|
9/17/2003 12:08:14 PM
|
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.
|
|
Reply By:
|
bani
|
Reply Date:
|
9/20/2003 10:17:02 AM
|
You can use the NewRow() of the DataTable object. Here is a code snippet and C#
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);
|