Re: Retrieving Record after INSERT INTO statement
From: Val Mazur (group51a_at_hotmail.com)
Date: 03/28/04
- Next message: William Ryan eMVP: "Re: Accessing DataTable Columns"
- Previous message: Stephen Wood: "Accessing DataTable Columns"
- In reply to: Joshua Ellul: "Re: Retrieving Record after INSERT INTO statement"
- Next in thread: David Browne: "Re: Retrieving Record after INSERT INTO statement"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 28 Mar 2004 16:47:53 -0500
Hi,
In case of the DataSet, it is suppose to populate identity values for the
inserted records.
In case of the regular SQL statement, you need to get it back. Check next
KBs about it
http://support.microsoft.com/default.aspx?scid=kb;en-us;320141&Product=adonet
http://support.microsoft.com/default.aspx?scid=kb;en-us;815629&Product=adonet
-- Val Mazur Microsoft MVP "Joshua Ellul" <jellul@onvol.net> wrote in message news:u3pGCtOFEHA.3096@TK2MSFTNGP11.phx.gbl... > Once I call the update will the record in the database and the instance in > the datatable be synchronised? I.e. I have an Autonumber field in which > the > database engine fills in the autonumber field and not my program, will my > program upon update have the value of the Autonumber field? > > Josh > > "Val Mazur" <group51a@hotmail.com> wrote in message > news:uomKAiCFEHA.2868@TK2MSFTNGP12.phx.gbl... >> Hi Joshua, >> >> If you execute action query, like INSERT, then there is no way to get >> this >> record back other than to use another SELECT statement. If you would like > to >> keep information on a client side as well, then add record to the > DataTable >> and then call Update method of the dataAdapter to insert record from the >> DataTable into actual table in a database. Otherwise you would need to > make >> two calls - INSERT and SELECT >> >> -- >> Val Mazur >> Microsoft MVP >> >> >> "Joshua Ellul" <jellul@onvol.net> wrote in message >> news:%238iflBBFEHA.1456@TK2MSFTNGP09.phx.gbl... >> > Hi There, >> > >> > I am using an OleDb.OleDbCommand to insert a new record using the >> > ExecuteNonQuery method with an SQL "INSERT INTO" statement. Is it >> > possible >> > to somehow retrieve the record/s inserted without having to perform an >> > additional SQL statement? >> > >> > If not, is there a different method to insert data which automatically >> > returns the record inserted? >> > >> > Best Regards, >> > >> > Joshua >> > >> > >> >> > >
- Next message: William Ryan eMVP: "Re: Accessing DataTable Columns"
- Previous message: Stephen Wood: "Accessing DataTable Columns"
- In reply to: Joshua Ellul: "Re: Retrieving Record after INSERT INTO statement"
- Next in thread: David Browne: "Re: Retrieving Record after INSERT INTO statement"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|