Re: Getting Autoincrement ID in ADO.NET



But really no one has answered my question as far. I am moving to
ADO.NET from ADO. And i just want to do the same thing i was doig in
ADO, but using the new technology. New technologies should be able to
do what Old technology did (easily), and even do it better (Am I wrong
here?). THEY SAID THAT .NET WILL CUT OUR DEVELOPMENT TIME. SO, I WANT
TO SEE THAT.

I have found a partial solution using ExecuteScalar.

CmdConn.ExecuteScalar("INSERT INTO tblCustomers(Name)VALUES('j. smith')
; SELECT @@IDENTITY")

But when I am doing my inserts, i don't usually use execute. I do
DataAdapter.Update( Dataset );

In ADO, I did this easily:

recordSet rs
rs.AddNew
rs("Name")="J. Smith"
rs.UpdateBatch()
NewID = rs("ID").value

there you go. 3 lines of code, and you are there. Now, I don't mean to
say that ADO.NET is bad. I think it's better. I just need to learn the
new way to do the same thing. As I am migrating my code, I usually do
this:

SQLDataAdapter da
Dataset ds
Datarow dr = ds.Tables(0).NewRow
dr("Name")="J. Smith"
da.Update(ds)
NewID = dr("ID") <-- Unlike in ADO, this one contains NOTHING.

so, I need some pointers as to how i could accomplish this... Is my
question clear ???

.



Relevant Pages

  • Re: DAO vs ADO
    ... ADO will be around for a while, but it's definitely not the way of the ... wouldn't necessarily recommend new development in deprecated ... Access isn't a deprecated technology ...
    (microsoft.public.access.conversion)
  • Re: DAO vs ADO
    ... ADO will be around for a while, but it's definitely not the way of the ... wouldn't necessarily recommend new development in deprecated ... Access isn't a deprecated technology ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Selecting Databases
    ... > I want to change my fondemental base from BDE to one another Technology, ... > Which Technology recommended, dbExpress or ADO? ... The BDE is not recommended for new projects now, ... dbExpress is lightweight, ...
    (borland.public.delphi.database.ado)
  • Re: Getting Autoincrement ID in ADO.NET
    ... One of the principle complaints about ADO classic was how it generated DML ... action commands at runtime. ... but using the new technology. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Access 2000 - Chronic Corruptions
    ... > Tim, thank you for the follow up. ... > About moving from DAO to ADO, I was out of options, my understanding ... > was that 2000 utilizes ADO as its preferred connectivity scheme. ... leaving Jet. ...
    (microsoft.public.access.modulesdaovba)

Loading