Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

API Function SQLColumns

Status
Not open for further replies.

pcawdron

Programmer
Jun 14, 2000
109
AU
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 ODBC [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top