The following code works for SQLTables (currently rem'd out) but fails for SQLColumns. Any ideas why??? The return code is 100 SQL_No_Data_Found. I've run this on an AS400 Data Source as well as SQL Server.
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, "DSN_Name", SQL_NTS, "", 0, "", 0)
R = SQLAllocStmt(hdbc, hstmt)
' R = SQLTables(hstmt, Null, 0, Null, 0, Null, 0, Null, 0)
R = SQLColumns(hstmt, Null, 0, Null, 0, "SYGHREP", SQL_NTS, Null, 0)
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,
pcawdron@gmac.com.au
PS. This Question is also posted under Visual Basic
[sig][/sig]
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, "DSN_Name", SQL_NTS, "", 0, "", 0)
R = SQLAllocStmt(hdbc, hstmt)
' R = SQLTables(hstmt, Null, 0, Null, 0, Null, 0, Null, 0)
R = SQLColumns(hstmt, Null, 0, Null, 0, "SYGHREP", SQL_NTS, Null, 0)
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,
pcawdron@gmac.com.au
PS. This Question is also posted under Visual Basic
[sig][/sig]