Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #5422

Re: Ado SQL UniqueIdentifier

From "Er!k \\/!$$Er" <nospam@nospam.url>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Ado SQL UniqueIdentifier
Date 2013-06-30 16:01 +0200
Organization Netfront http://www.netfront.net/
Message-ID <kqpdof$16fa$1@adenine.netfront.net> (permalink)
References <d3e8bbdc-b02f-4fca-a5af-2422241a67fc@googlegroups.com>

Show all headers | View raw


Rob,
Asuming your identifier is set as primary key  (it shoud be), you can call:

"SELECT scope_identity()"

hth

Erik


"Rob van Erk"  schreef in bericht 
news:d3e8bbdc-b02f-4fca-a5af-2422241a67fc@googlegroups.com...

Hi guys,

A simple question:

When creating a record using Ado connection I directly want to know what 
UniqueIdentifier has been created by the SQL Server.

So, I have something like:

sSQL       := "INSERT INTO DBTIMEREG pcname) VALUE('" + sPCname + "')
oConn      := AdoGetConnection()
oRecordset := oConn:Execute(sSQL,@liRecs,adCmdText)

The SQL DB has two fields and SQL will automatically create the 
uniqueidentifier. So, in SQL DB I have two fields:

sPCname cChar(30)
sUniID  UniqueIdentifier

My idea was to use:
   oSvr        := AdoServer{oRecordset}
   oSvr:fieldget(#IDnumber)

but this seems not possible (most probably because the sSQL string still has 
same value ("INSERT INTO...."). How to read the value of a just written SQL 
record?

Thanks,
Rob

Thanks 


--- news://freenews.netfront.net/ - complaints: news@netfront.net ---

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Ado SQL UniqueIdentifier Rob van Erk <erk.v@hotmail.com> - 2013-06-30 02:55 -0700
  Re: Ado SQL UniqueIdentifier "Er!k \\/!$$Er" <nospam@nospam.url> - 2013-06-30 16:01 +0200
  Re: Ado SQL UniqueIdentifier "andrej Terkaj" <aterkaj@task.si> - 2013-06-30 16:04 +0200
  Re: Ado SQL UniqueIdentifier Rob van Erk <erk.v@hotmail.com> - 2013-06-30 10:15 -0700
    Re: Ado SQL UniqueIdentifier Carlos Rocha <FreeTheMusic@ascap.com> - 2013-06-30 18:27 +0100
    Re: Ado SQL UniqueIdentifier "Er!k \\/!$$Er" <nospam@nospam.url> - 2013-07-01 08:31 +0200
  Re: Ado SQL UniqueIdentifier Rob van Erk <erk.v@hotmail.com> - 2013-07-01 12:33 -0700

csiph-web