Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ODBC API - SQLPrimaryKeys() not working
Message
From
18/12/1999 18:38:54
 
 
To
18/12/1999 18:31:17
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00305684
Message ID:
00305730
Views:
30
>Hi!
>
>Tried it out but it still returns 65534
>

You need to issue a SQLGetDiagRec to retrieve the extended error code.

>ls_PKey = GetPKeys("northwnd","dbo","Products")
>*-- ls_PKey is always 65534
>
>Sarosh
>
>Func GetPKeys(as_TableQualifier, as_TableOwner, as_TableName)
>local ls_Return, oHeap, nCatNamePtr, nSchNamePtr, nTabNamePtr, m.olddec
>
>m.olddec = set("decimal")
>set deci to 0
>hstmt = val(SYS(3053)) && SYS(3053) - ODBC Environment Handle
>set deci to (m.olddec)
>
>DECLARE INTEGER SQLPrimaryKeys IN ODBC32 ;
>INTEGER hStmt, ;
>INTEGER nCatalogNamePtr, ;
>SHORT nCatalogNameLength, ;
>INTEGER nSchemaNamePtr, ;
>SHORT nSchemaNameLength, ;
>INTEGER nTableNamePtr, ;
>SHORT nTableNameLength
>
>SET PROC TO CLSHEAP ADDITIVE
>oHeap = CREATEOBJ('Heap')
>nCatNamePtr = oHeap.AllocString(as_TableQualifier)
>nSchNamePtr = oHeap.AllocString(as_TableOwner)
>nTabNamePtr = oHeap.AllocString(as_TableName)
>
>ls_Return = SQLPrimaryKeys(hstmt, ;
>@ nCatNamePtr, ;
>LEN(as_TableQualifier) + 1, ;
>@ nSchNamePtr, ;
>LEN(as_TableOwner)+ 1, ;
>@ nTabNamePtr, ;
>LEN(as_TableName) + 1 )
>
>oHeap = null
>RELEASE PROC CLSHEAP
>
>Return ls_Return
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform