MySQL Forums
Forum List  »  MySQL for Visual Studio

Get ID after INSERT via MySqlDataAdapter
Posted by: Max Asker
Date: July 03, 2017 11:08AM

Hello,
I use Win-10 & C# via VS-E-2015 & Connector/NET 6.9.9

I want to add many rows 'at once' to a table.
For this I use 'MySqlDataAdapter' & 'MySqlCommandBuilder' & 'DataSet'
After many
* 'MyRow = MyDataSet.Tables[0].NewRow();'
* 'MyRow["age"] = currentAge;'
* 'MyDataSet.Tables[0].Rows.Add(MyRow);'
Finally I execute 'MyDataAdapter.Update(MyDataSet);'.
This part already works fine.


The question is:
In order to maintain a additional 'Reference-Table' I do need the automatically generated IDs (PRIMARY KEY) of the just produced data-row.
How can I get the new IDs?

Thanks for your help!

Options: ReplyQuote


Subject
Views
Written By
Posted
Get ID after INSERT via MySqlDataAdapter
164
July 03, 2017 11:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.