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.

ClientDataSet error

3 posts in Networking Last posting was on 2004-10-05 22:12:49.0Z
Peter Posted on 2004-10-03 19:06:28.0Z
From: "Peter" <peter@hartec.co.uk>
Newsgroups: Advantage.Networking
Subject: ClientDataSet error
Date: Sun, 3 Oct 2004 20:06:28 +0100
Lines: 69
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 81.76.29.146
Message-ID: <41604e07@solutions.advantagedatabase.com>
X-Trace: 3 Oct 2004 13:07:51 -0700, 81.76.29.146
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!81.76.29.146
Xref: solutions.advantagedatabase.com Advantage.Networking:477
Article PK: 1131901

Hi

Ads Server version 6.2. Using Local server on one system, and Netware
Remote server (4.11 SP9) on another.

The app. needs to findout who is using a certain TAdsTable, so I tried the
following code. But on both systems I get:

"GetUserNames Error 5021" when AdsMgGetUserNames is called.

sPath is valid, eg "c:\....\datafiles\"
sPathAndName is also valid, eg "c:\....\datafiles\tablename.adt".

Can anyone tell me what I am doing wrong?

procedure WhoIsUsingTable(AdsTable: TAdsTable);
const
MAX_NUM_USERS = 50;
MAX_NUM_TABLES = 50;
var
sPathAndName,
sPath,
sTableName: string;
ulRetVal,
usStructSize,
usArrayLen,
usCount: UNSIGNED16;
hMgmtHandle: ADSHANDLE;
astUserInfo : array[0..MAX_NUM_USERS] of ADS_MGMT_USER_INFO;
begin
sTableName := AdsTable.TableName;
sPath := AdsTable.GetDatabasePath + '\';
sPathAndName := sPath + sTableName;
usArrayLen := ADS_USER_ARRAY_SIZE - 1;
usStructSize := sizeof( ADS_MGMT_USER_INFO );

// Get the Handle...
ulRetVal := ACE.AdsMgConnect(PChar(sPath), nil, nil, @hMgmtHandle );

if ( ulRetVal <> AE_SUCCESS ) then // NO ERROR HERE********
begin
ShowMessage( 'Get Connection Handle Error No ' + IntToStr(ulRetVal));
exit;
end;

ulRetVal := ACE.AdsMgGetUserNames(hMgmtHandle,
PChar(sPathAndName),
@astUserInfo,
@usArrayLen,
@usStructSize );

if ( ulRetVal <> AE_SUCCESS ) then // ERROR 5021 OCCURS HERE
*************************...
begin
ShowMessage( 'Get User Names Error No ' + IntToStr(ulRetVal) + ' File
Name: ' + sPathAndName +
' sPath: ' + sPath);
exit;
end;
...... etcetera

end;


Thanks

Peter


Lance Schmidt Posted on 2004-10-04 15:15:09.0Z
From: "Lance Schmidt" <LanceSc@ExtendSys.com>
Newsgroups: Advantage.Networking
References: <41604e07@solutions.advantagedatabase.com>
Subject: Re: ClientDataSet error
Date: Mon, 4 Oct 2004 09:15:09 -0600
Lines: 86
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 198.102.102.147
Message-ID: <4161694e@solutions.advantagedatabase.com>
X-Trace: 4 Oct 2004 09:16:30 -0700, 198.102.102.147
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!198.102.102.147
Xref: solutions.advantagedatabase.com Advantage.Networking:478
Article PK: 1131902

Hi Peter,

You are not passing in the correct size of the array in your code. You
create an array of 51 users (MAX_NUM_USERS), but then tell Advantage the
array is really 200 users in length (ADS_USER_ARRAY_SIZE). If you set
usArrayLen to the correct size your code should work.

Best Regards,

Lance Schmidt
Advantage R&D
LanceSc@ExtendSys.com

"Peter" <peter@hartec.co.uk> wrote in message
news:41604e07@solutions.advantagedatabase.com...
> Hi
>
> Ads Server version 6.2. Using Local server on one system, and Netware
> Remote server (4.11 SP9) on another.
>
> The app. needs to findout who is using a certain TAdsTable, so I tried the
> following code. But on both systems I get:
>
> "GetUserNames Error 5021" when AdsMgGetUserNames is called.
>
> sPath is valid, eg "c:\....\datafiles\"
> sPathAndName is also valid, eg "c:\....\datafiles\tablename.adt".
>
> Can anyone tell me what I am doing wrong?
>
> procedure WhoIsUsingTable(AdsTable: TAdsTable);
> const
> MAX_NUM_USERS = 50;
> MAX_NUM_TABLES = 50;
> var
> sPathAndName,
> sPath,
> sTableName: string;
> ulRetVal,
> usStructSize,
> usArrayLen,
> usCount: UNSIGNED16;
> hMgmtHandle: ADSHANDLE;
> astUserInfo : array[0..MAX_NUM_USERS] of ADS_MGMT_USER_INFO;
> begin
> sTableName := AdsTable.TableName;
> sPath := AdsTable.GetDatabasePath + '\';
> sPathAndName := sPath + sTableName;
> usArrayLen := ADS_USER_ARRAY_SIZE - 1;
> usStructSize := sizeof( ADS_MGMT_USER_INFO );
>
> // Get the Handle...
> ulRetVal := ACE.AdsMgConnect(PChar(sPath), nil, nil, @hMgmtHandle );
>
> if ( ulRetVal <> AE_SUCCESS ) then // NO ERROR HERE********
> begin
> ShowMessage( 'Get Connection Handle Error No ' + IntToStr(ulRetVal));
> exit;
> end;
>
> ulRetVal := ACE.AdsMgGetUserNames(hMgmtHandle,
> PChar(sPathAndName),
> @astUserInfo,
> @usArrayLen,
> @usStructSize );
>
> if ( ulRetVal <> AE_SUCCESS ) then // ERROR 5021 OCCURS HERE
> *************************...
> begin
> ShowMessage( 'Get User Names Error No ' + IntToStr(ulRetVal) + ' File
> Name: ' + sPathAndName +
> ' sPath: ' + sPath);
> exit;
> end;
> ...... etcetera
>
> end;
>
>
> Thanks
>
> Peter
>
>


Peter Posted on 2004-10-05 22:12:49.0Z
From: "Peter" <peter@hartec.co.uk>
Newsgroups: Advantage.Networking
References: <41604e07@solutions.advantagedatabase.com> <4161694e@solutions.advantagedatabase.com>
Subject: Re: ClientDataSet error
Date: Tue, 5 Oct 2004 23:12:49 +0100
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 81.77.81.192
Message-ID: <41631cd5@solutions.advantagedatabase.com>
X-Trace: 5 Oct 2004 16:14:45 -0700, 81.77.81.192
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!81.77.81.192
Xref: solutions.advantagedatabase.com Advantage.Networking:479
Article PK: 1131903

Thanks Lance,

That fixed it.

Regards

Peter

"Lance Schmidt" <LanceSc@ExtendSys.com> wrote in message
news:4161694e@solutions.advantagedatabase.com...
> Hi Peter,
>
> You are not passing in the correct size of the array in your code. You
> create an array of 51 users (MAX_NUM_USERS), but then tell Advantage the
> array is really 200 users in length (ADS_USER_ARRAY_SIZE). If you set
> usArrayLen to the correct size your code should work.
>
> Best Regards,
>
> Lance Schmidt
> Advantage R&D
> LanceSc@ExtendSys.com
>
>