Home > Archive > MS SQL Server ODBC > April 2005 > ODBC catalog function call return error on sql server 2005









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ODBC catalog function call return error on sql server 2005
Jing

2005-04-28, 11:23 am

Hi,

I am having a problem for the ODBC catalog functions, the
server is sql server 2005 express beta2 and sql server 2005 beta2.

the code is as follows:

----------

RETCODE nRetCode;

AFX_SQL_ASYNC(this, SQLTables( m_hstmt,
(m_strQualifierParam
.IsEmpty()? (UCHAR FAR *)NULL: (UCHAR FAR *)(const
char*) m_strQualifierParam)
,
SQL_NTS,
(m_strOwnerParam.IsEmpty()? (UCHAR FAR *)NULL: (UCHAR FAR *)(const
char*)m_strOwnerPara
m),
SQL_NTS,
(m_strTableNameParam
.IsEmpty()? (UCHAR FAR *)NULL: (UCHAR FAR *)(const
char*)m_strTableName
Param),
SQL_NTS,
(m_strTableTypeParam
.IsEmpty()? (UCHAR FAR *)NULL: (UCHAR FAR *)(const
char*)m_strTableType
Param),
SQL_NTS ));


UCHAR sqlState[6]; /* buffer to store SQLSTATE */
SDWORD nativeErr; /* native error code */
UCHAR errMsg[100]; /* buffer to store error message */
SWORD realMsgLen; /* real length of error message */

if( nRetCode == SQL_ERROR )
{

RETCODE etcode1 = SQLError( SQL_NULL_HDBC,
SQL_NULL_HDBC, m_hstmt, sqlState, &nativeErr, errMsg,
100, &realMsgLen);
}

----------

the parameter values for my case:
m_strQualifierParam,
m_strOwnerParam, m_strTableTypeParam
are all empty
m_strTableNameParam is "bl" which is a table in the
database for sure.


the error values are:
sqlstate:s0002
nativeerr:208
errMsg: "Invalid object name '#sptables'"


I also got errors for function call to "SQLForeignKeys"
with the errMsg as "Invalid object name '#spfkeys'",
and "SQLPrimaryKeys" with errMsg as "Invalid object
name '#sppkeys'". I guess all catalog functions do not
work.

I have tried both the SQL Server 2005 and 2005 express.

The same code and database file .mdf just work perfectly
for SQL Server 2000. For the ODBC data source, I have
tried both SQL Server and SQL Native Client.


I do appreciate your help.

Thanks.

Jing

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com