Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #5421 > unrolled thread
| Started by | Rob van Erk <erk.v@hotmail.com> |
|---|---|
| First post | 2013-06-30 02:55 -0700 |
| Last post | 2013-07-01 12:33 -0700 |
| Articles | 7 — 4 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
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
| From | Rob van Erk <erk.v@hotmail.com> |
|---|---|
| Date | 2013-06-30 02:55 -0700 |
| Subject | Ado SQL UniqueIdentifier |
| Message-ID | <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
[toc] | [next] | [standalone]
| From | "Er!k \\/!$$Er" <nospam@nospam.url> |
|---|---|
| Date | 2013-06-30 16:01 +0200 |
| Message-ID | <kqpdof$16fa$1@adenine.netfront.net> |
| In reply to | #5421 |
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 ---
[toc] | [prev] | [next] | [standalone]
| From | "andrej Terkaj" <aterkaj@task.si> |
|---|---|
| Date | 2013-06-30 16:04 +0200 |
| Message-ID | <kqpdsm$lgk$1@news.siol.net> |
| In reply to | #5421 |
Hi Rob !
I use an opposite way and it works:
oSrv:append()
oSrv:FieldPut("PCNAME",sPCNAME)
oSrv:Commit()
//oSrv:Requery()
//oSrv:Close()
oRecordSet := AdoRecordSet{}
oRecordSet:Open(sStatement,oConn,adOpenForwardOnly,adLockReadOnly,
AdCmdText)
oRecordSet:Fieldget("PCNAME")
------------------------------------------------------------------
If you will use your way, try with oRecordSet:Requery()
Best Regards
Andrej
"Rob van Erk" <erk.v@hotmail.com> wrote in message
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
>
[toc] | [prev] | [next] | [standalone]
| From | Rob van Erk <erk.v@hotmail.com> |
|---|---|
| Date | 2013-06-30 10:15 -0700 |
| Message-ID | <8b8c5e4d-21e6-4fc6-b955-0603e7c5904f@googlegroups.com> |
| In reply to | #5421 |
Sorry guys, long time I have been working with vO (what a shame.... :-) and I do not understand how to get this fixed. Erik mentions I can use:
SELECT scope_identity()"
but running this I get a "NILL". My Unid has primary key in SQL2005 Server. So, I use something like:
insert into dbtimereg (username,logindate,logintime,logoffdate,logofftime, pc,citrix,pcname) values('rob','300613','1800','300613','2100','PC1','No','JDKLSDW');SELECT scope_identity()'
The record is just added, a unique identifier does exist in Unid field and I would directly would like to get the Unid value back in a string value.
The requery does not seem to work and I hoped I could used some RETURN value in the SQL Statement but this does also not work.
I will investigate further but any help would be appreciated.
Brgds,
Rob
[toc] | [prev] | [next] | [standalone]
| From | Carlos Rocha <FreeTheMusic@ascap.com> |
|---|---|
| Date | 2013-06-30 18:27 +0100 |
| Message-ID | <kqpps7$e1b$1@news.albasani.net> |
| In reply to | #5424 |
Rob van Erk explained on 30-06-2013 :
Hi Rob,
> Sorry guys, long time I have been working with vO (what a shame.... :-) and I
> do not understand how to get this fixed. Erik mentions I can use:
>
> SELECT scope_identity()"
>
> but running this I get a "NILL". My Unid has primary key in SQL2005 Server.
> So, I use something like:
>
> insert into dbtimereg (username,logindate,logintime,logoffdate,logofftime,
> pc,citrix,pcname)
> values('rob','300613','1800','300613','2100','PC1','No','JDKLSDW');SELECT
> scope_identity()'
>
> The record is just added, a unique identifier does exist in Unid field and I
> would directly would like to get the Unid value back in a string value.
>
> The requery does not seem to work and I hoped I could used some RETURN value
> in the SQL Statement but this does also not work.
>
I don't know SQL Server, but in any SQL engine a select statement
returns a recordset, so your answer should be in the recordset returned
by SELECT scope_identity()
--
Carlos Rocha
[toc] | [prev] | [next] | [standalone]
| From | "Er!k \\/!$$Er" <nospam@nospam.url> |
|---|---|
| Date | 2013-07-01 08:31 +0200 |
| Message-ID | <kqr7om$2sc3$1@adenine.netfront.net> |
| In reply to | #5424 |
Rob,
Have a look at the VO2ADO doc's about Multiple resultsets and/or the
AdoRecordset:NextRecordSet() method.
hth,
Erik
"Rob van Erk" schreef in bericht
news:8b8c5e4d-21e6-4fc6-b955-0603e7c5904f@googlegroups.com...
Sorry guys, long time I have been working with vO (what a shame.... :-) and
I do not understand how to get this fixed. Erik mentions I can use:
SELECT scope_identity()"
but running this I get a "NILL". My Unid has primary key in SQL2005 Server.
So, I use something like:
insert into dbtimereg (username,logindate,logintime,logoffdate,logofftime,
pc,citrix,pcname)
values('rob','300613','1800','300613','2100','PC1','No','JDKLSDW');SELECT
scope_identity()'
The record is just added, a unique identifier does exist in Unid field and I
would directly would like to get the Unid value back in a string value.
The requery does not seem to work and I hoped I could used some RETURN value
in the SQL Statement but this does also not work.
I will investigate further but any help would be appreciated.
Brgds,
Rob
--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [next] | [standalone]
| From | Rob van Erk <erk.v@hotmail.com> |
|---|---|
| Date | 2013-07-01 12:33 -0700 |
| Message-ID | <70507977-2fd5-4343-93a8-46db4587af97@googlegroups.com> |
| In reply to | #5421 |
Thanks for all the input given :-)
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web