Getting the last serial field inserted per session
Posted in 2005
Topics: Storage & Space Management, Connectivity: ODBC / JDBC / .NET, Security, Permissions & Auditing, Data Types & Schema Design, Versions, Editions & End-of-Life
Toolset:
-IDS 9.4FC6, ODBC 2.81, MS .Net, ADO.Net
One of our developers is trying to find a way to get the last serial value
inserted into a table for a particular session. He's trying to use this
query, which works in ISQL, but does not work from the .NET app.
insert into kenn_test(testtext) values('7');select dbinfo('sqlca.sqlerrd1') from systables where tabid=1
Schema for the table is
{ TABLE "kenn".kenn_test row size = 25 number of columns = 2 index size = 0 }
create table "kenn".kenn_test
(
uid serial not null ,
testtext varchar(20)
) in invty2 extent size 16 next size 16 lock mode row;
revoke all on "kenn".kenn_test from "public";
When he runs the query from isql, he gets the last serial value. When he runs
it from .Net, it always returns 0. Any ideas to give him?
DT
--
Dave Thacker
Senior Systems Administrator
Omni Hotels Reservation Center
V:402-952-6535 F:402-334-8013 M: 402-981-4613 (24/7)
sending to informix-list
Dave Thacker wrote:
It may be that .NET is performing some housekeeping query in between the
INSERT and the SELECT DBINFO... so that the information is no longer
available. Try Jean's suggestion to use the IBM/Informix OLE provider
instead of .NET
Art S. Kagel
> Toolset:
> -IDS 9.4FC6, ODBC 2.81, MS .Net, ADO.Net
>
> One of our developers is trying to find a way to get the last serial value
> inserted into a table for a particular session. He's trying to use this
> query, which works in ISQL, but does not work from the .NET app.
>
> insert into kenn_test(testtext) values('7');> select dbinfo('sqlca.sqlerrd1') from systables where tabid=1
>
> Schema for the table is
> { TABLE "kenn".kenn_test row size = 25 number of columns = 2 index size = 0 }
> create table "kenn".kenn_test
> (
> uid serial not null ,
> testtext varchar(20)
> ) in invty2 extent size 16 next size 16 lock mode row;
> revoke all on "kenn".kenn_test from "public";>
> When he runs the query from isql, he gets the last serial value. When he runs
> it from .Net, it always returns 0. Any ideas to give him?
>
> DT