Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

error 5068 and auto-increment value

2 posts in Visual Basic Last posting was on 2006-07-17 17:48:51.0Z
Tom G. Posted on 2006-07-09 23:45:56.0Z
From: "Tom G." <tgalaj@verizon.net>
Newsgroups: Advantage.Visual_Basic
Subject: error 5068 and auto-increment value
Date: Sun, 9 Jul 2006 19:45:56 -0400
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 151.205.116.144
Message-ID: <44b1945b@solutions.advantagedatabase.com>
X-Trace: 9 Jul 2006 17:42:19 -0700, 151.205.116.144
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!151.205.116.144
Xref: solutions.advantagedatabase.com Advantage.Visual_Basic:1099
Article PK: 1137892

I am writing VB6 program using ACE (Advantage Client Engine). The program
reads several Advantage tables and gets information from there. I have a
problem when I try to read the auto-increment value type (ADS_AUTOINC = 15).
I can see the information in the table from my "binary file editor", but
when I try to use ACE call, I'm getting error 5068, "no current record".

The code is (more or less) like this:
(pieces taken from Advantage page code examples)

iRet = AdsGetFieldLength(m_lTbl, FieldName, FieldLen) '<==
returns "0"
FieldVal = String(FieldLen, " ")
iRet = AdsGetField(m_lTbl, FieldName, FieldVal, FieldLen, ADS_TRIM)

At this point, "iRet" is set to 5068, and I can not get any further
information from the table.
I only seems to happen for ADS_AUTOINC type of field.

Am I doing something wrong?
Can anyone give me an advice on how to fix it?

Thanks in advance!

Tom


Mark Wilkins Posted on 2006-07-17 17:48:51.0Z
From: "Mark Wilkins" <tired@of.spam>
Newsgroups: Advantage.Visual_Basic
References: <44b1945b@solutions.advantagedatabase.com>
Subject: Re: error 5068 and auto-increment value
Date: Mon, 17 Jul 2006 11:48:51 -0600
Lines: 53
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
NNTP-Posting-Host: 10.24.38.161
Message-ID: <44bbcca2@solutions.advantagedatabase.com>
X-Trace: 17 Jul 2006 11:45:06 -0700, 10.24.38.161
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!10.24.38.161
Xref: solutions.advantagedatabase.com Advantage.Visual_Basic:1100
Article PK: 1137894

Hi Tom,

The AdsGetField API should work fine for an auto-increment field, although
AdsGetLong might be a better choice. As long as your are positioned on a
record, then there should not be any different processing for ADS_AUTOINC
than other field types. If you post some example code that re-creates the
problem, we can take a look at it.

One problem I do see is the use of AdsGetFieldLength. That could cause
problems when the autoinc value is greater than 999. AdsGetFieldLength will
return 4 (autoincs are 4 bytes long in the record). But AdsGetField returns
a string that could be up to 10 digits long. And it also needs room for a
null terminator. So for an autoinc field, AdsGetField would need a buffer
of length 11 (a signed integer would need one more for the sign). That is
why AdsGetLong might be a better choice.

Mark Wilkins
Advantage R&D

"Tom G." <tgalaj@verizon.net> wrote in message
news:44b1945b@solutions.advantagedatabase.com...
>I am writing VB6 program using ACE (Advantage Client Engine). The program
>reads several Advantage tables and gets information from there. I have a
>problem when I try to read the auto-increment value type (ADS_AUTOINC =
>15).
> I can see the information in the table from my "binary file editor", but
> when I try to use ACE call, I'm getting error 5068, "no current record".
>
> The code is (more or less) like this:
> (pieces taken from Advantage page code examples)
>
> iRet = AdsGetFieldLength(m_lTbl, FieldName, FieldLen) '<==
> returns "0"
> FieldVal = String(FieldLen, " ")
> iRet = AdsGetField(m_lTbl, FieldName, FieldVal, FieldLen, ADS_TRIM)
>
> At this point, "iRet" is set to 5068, and I can not get any further
> information from the table.
> I only seems to happen for ADS_AUTOINC type of field.
>
> Am I doing something wrong?
> Can anyone give me an advice on how to fix it?
>
> Thanks in advance!
>
> Tom
>
>
>
>
>