Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding records to a database using ADO

Status
Not open for further replies.

cturland

Programmer
Sep 25, 2000
66
GB
Hi all,

Can anyone give me help with adding new records to a database using ADO. Do you have to run an add SQL query in the RecordSource?

Thanks,
Carl
 
Use the ADO command object to execute a sql string. The string should be something like "INSERT INTO myTable....."
 
Also, if you have some ADO Recordset, you can use the .addNew method of the recordset to add the new records.
 
The .addNew command only as the data to the recordset and not to the database............doesn't it?
 
Correct, but then you use the .update to update the actual database.
 
Ah I see!!

I was working along the right lines but I guess somewhere my syntax is wrong. Would you be able to write a quick bit of sample code for me? For example to add the string in text1.text into a column called Name in the database.

Thanks for your help,
Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top