Adding new records to a dataset 
Author Message
 Adding new records to a dataset

Does anyone have an example of adding a new record to a
dataset?  I have 2 bound text boxes on my form which work
okay.  I run into problems because I have a 3rd column in
the table I want to set through the code before I update.

Thanks



Mon, 19 Apr 2004 00:18:28 GMT  
 Adding new records to a dataset
Well, you don't add a row to a dataset, you add it to a datatable:

'create the new row
dim drNew as System.Data.DataRow
drNew = me.myDataSet.myDataTable.NewRow

'set the value
drNew.Item("myField") = whatever

'append it to the table
me.myDataSet.myDataTable.Rows.Add(drNew)

HTH

--
Rebecca Riordan

Designing Relational Database Systems
http://mspress.microsoft.com/books/3222.htm
Microsoft SQL Server 2000 Programming Step by Step
http://mspress.microsoft.com/prod/books/4713.htm

Blessed are they who can laugh at themselves,
for they shall never cease to be amused...


Quote:
> Does anyone have an example of adding a new record to a
> dataset?  I have 2 bound text boxes on my form which work
> okay.  I run into problems because I have a 3rd column in
> the table I want to set through the code before I update.

> Thanks



Sat, 24 Apr 2004 02:05:22 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. adding new records & new record

2. Help: entering new record to dataset

3. how to add a new dataset from excel to access by means of vba

4. Adding new rows to related tables on a dataset

5. Adding a new row to a Dataset

6. HELP with adding new rows to a dataset

7. Can't add a record to dataset??

8. adding more than 1 record to dataset with an autoincrement field

9. deleting records in a table and then adding new records

10. How to add new records in a new database

11. ADO2.5, can't add new record to an empty table using record binding

12. Add new record with coding.

 

 
Powered by phpBB® Forum Software