Unix Technical Forum

Getting the last serial field inserted per session

This is a discussion on Getting the last serial field inserted per session within the Informix forums, part of the Database Server Software category; --> Toolset: -IDS 9.4FC6, ODBC 2.81, MS .Net, ADO.Net One of our developers is trying to find a way to ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 09:10 AM
Dave Thacker
 
Posts: n/a
Default Getting the last serial field inserted per session


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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 09:11 AM
Art S. Kagel
 
Posts: n/a
Default Re: Getting the last serial field inserted per session

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:19 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com