AnsweredAssumed Answered

get sequence nextval in postgres

Question asked by geonetadmin on Jan 21, 2011
Latest reply on Jan 24, 2011 by geonetadmin
Original User: dwoods

I have been using the C# code sample that uses IQueryDef to get the nextval from a sequence in our Oracle database.  Now I am trying to port the code to postgres.  I would prefer to keep it in ArcObjects rather than make a db connection and run it in PostgreSQL.  Does anyone have a working code snippet?  I have tried many variations with the original code sample to no avail. This is what I was using in Oracle:

            IFeatureWorkspace featureWorkspace = workspace as IFeatureWorkspace;
            IQueryDef queryDef;
            ICursor cursor;
            IRow row;
            double seqValue;

            queryDef = featureWorkspace.CreateQueryDef();
            queryDef.SubFields = "owner.seq_name.nextval";
            queryDef.Tables = "sys.dual";
            cursor = queryDef.Evaluate();
            row = cursor.NextRow();
            seqValue = double.Parse(row.get_Value(0).ToString());

Outcomes