954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to insert data to SQL QUERY USING ADO.NET

I have Sql query consists of multiple tables in ms Access database(has Join Right/inner join) and I would like to insert and Update data on it using ADO.NET. I would be most grateful if someone could provide me with a clear example.

Thanx

HardWorker2
Newbie Poster
4 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

I need to know the structure of the tables, the relationship between them, and the names of the fields you want to update.

Reverend Jim
Posting Shark
Moderator
1,167 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 

And please include the query you already have and a description of what you are trying to do.

Reverend Jim
Posting Shark
Moderator
1,167 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 

Thank you very much for your reply.

The SQL query is based on two tables (books and authors) that have one-to-many relationship:

SELECT books.title, books.publisher, books.year, book.ISBN FROM authors RIGHT JOIN books ON authors.author_id = books.author_id where authors.name='John'"

As it can be seen from the SQL statement above, I need to insert data only to the books table with the fields: title, publisher, year and ISBN. The authors table has already data.

I am familiar with the old version of ADO and it was easy to run such this sql statament using ADODB Recordset which can be done in one go. But as a vb.net immigrant, I found difficulty to use DataAdobtar, Dataset and DataRow in Ado.Net, because they need the name of table while I have more than one tables and sometimes I need to insert data to particular tables.

Would really appreciate if you could give me a clear answer.

HardWorker2
Newbie Poster
4 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

'Fraid I can't help you with data adaptors and such. I'm strictly a hardcore ADO person. I developed all of my software using vbScript (mostly background data mining/massaging) so all my stuff used bare bones ADO, bulk loads and recordsets. I saw your thread title and did a silent "whee" figuring that I could help out. Bummer.

Reverend Jim
Posting Shark
Moderator
1,167 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159
 

Thanks.

HardWorker2
Newbie Poster
4 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

Hi everybody!

I found the solution at:

http://msdn.microsoft.com/en-us/library/aa289510%28v=vs.71%29.aspx

Hope this will help others.

HardWorker2
Newbie Poster
4 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You