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);





Go to topic 4072

Return to index page 1042
Return to index page 1041
Return to index page 1040
Return to index page 1039
Return to index page 1038
Return to index page 1037
Return to index page 1036
Return to index page 1035
Return to index page 1034
Return to index page 1033