ODBC API Call SQLTables

pcawdron
09-17-2000, 11:08 PM
Does anyone have any idea why the following code doesn't work???

It'll run beautifully for SQLTables (currently rem'd out) but it receives the return code 100 - SQL_No_Data_Fetched.
I've tried every conceivable combination for SQLColumns... all parameters as

...Null, 0...
..."",0...
... "", SQL_NTS...
..."%",SQL_NTS...
and finally, as you can see below, a known table and column - but it always returns 100


Function Tables()
Dim R As Integer, henv As Long, hdbc As Long, hstmt As Long, Result As String * 128, Length As Long
R = SQLAllocEnv(henv)
R = SQLAllocConnect(henv, hdbc)
R = SQLConnect(hdbc, "GMAC", 4, "", 0, "", 0)
R = SQLAllocStmt(hdbc, hstmt)
' R = SQLTables(hstmt, Null, 0, Null, 0, Null, 0, Null, 0)
R = SQLColumns(hstmt, Null, 0, Null, 0, "WSNUCPP", SQL_NTS, "NUBBCD", SQL_NTS)
R = SQLFetch(hstmt)
Do While R = SQL_SUCCESS
R = SQLGetData(hstmt, 3, SQL_C_CHAR, Result, 128, Length)
If Length > 0 Then Debug.Print Left(Result, Length)
R = SQLFetch(hstmt)
Loop
R = SQLFreeStmt(hstmt, SQL_DROP)
End Function


Thanks for your help with this. It's very frustrating.

Regards,

Peter

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum