I want the last inserted id to be returned when pasted into my visual C # program.
// Insert to database try { int result = int.Parse(tblClipManagerTableAdapter.InsertQuery(textBox2.Text, textBox1.Text).ToString()); MessageBox.Show(result.ToString()); } catch (Exception ex) { MessageBox.Show("Fejl: " + ex.Message.ToString()); }
Error: "The reference to the object is not installed in the instance of the object."
I set the tblClipManagerTableAdable.InsertQuery runtime for the scalar.
Any help on returning the last inserted id with my current code and setting?
Using a local SQL database (dbClipManager.sdf).
Best wishes
EDIT
I think I found what I could use.
But I am very new to this. Not sure how to fill in the code? I used only to use datasets, and not to open connections, execute SQL commands .: O /
http://social.msdn.microsoft.com/Forums/en-US/sqlce/thread/1d1d3267-dc29-470b-bb20-00487a39bc87/
Best wishes
source share