Add new record

  • Thread starter Thread starter Arni
  • Start date Start date
A

Arni

I have a form connected to a database (by
OleDbConnection). I can travel between records without a
problem and change record (only one record visible at
time in the form).
I have not managed to program behind a button that will
add new record. Can you tell me how?
Best regards,
Arni L.
 
Hi Arni,

Only the OleDbConnection is not enought to travel between the records, what
do you use, datareader, dataset, datagrid, dataview, etc?

Maybe we can help you as we know that

Cor
 
Dear Cor,
I use an OleDbDataAdapter and a DataSet.
Then I have five textboxes where each is connected to a
field in a record (DataBinding).

Navigation between records is not a problem.
Only how to add a new record.

I look forward to see your reply.

Thanks, Arni L.
 
Hi Arni,

I type it here just in this mail so watch little typeos
\\\
dim dr as datarow = datasetArni.tables(x).newrow
dr("whatever")="whatever"
dr("somethingelse")="somethingelse"
datasetArni.tables(x).rows.add(dr)
///

I hope this helps?

Cor
 
Thanks Cor,

The code you sent does work if you are adding fixed info.
How do you start with an empty record on the form, which
the user fill in and will be saved as new record?

Thanks, Arni
 
Hi Arni,

You never can bind to nothing, so you have then to make an empty row.
But keep in mind that if there are keys in that you have to fill that first.

Cor
 
Thanks Cor,
Regards,
Arni L.
-----Original Message-----
Hi Arni,

You never can bind to nothing, so you have then to make an empty row.
But keep in mind that if there are keys in that you have to fill that first.

Cor


.
 
Back
Top