FIX: ????? SQLColAttribute ???? ?????? ??? ???? ??? ??? ?????? ????? ??? ??????

?????? ????????? ?????? ?????????
???? ???????: 290646 - ??? ???????? ???? ????? ????? ??? ???????.
BUG #: 46409 (SHILOH_bug)
????? ???: 56030 (sqlbug_70)
????? ???? | ?? ????

?? ??? ??????

???????

??? ??????? ???? SQLColAttribute ?????? ??????? ???? SQL_DESC_SCHEMA_NAME ?? SQL_DESC_TABLE_NAME SQL_DESC_BASE_TABLE_NAME ?? SQL_DESC_CATALOG_NAME ?? ??? ????? ??? ??? ????? ??? ??? ???? ????? ??? ????.

?????

?????? ODBC ??????? ?????? ???????? SQL Server ?? ????? Computer.Database.Owner.Object.

????

SQL Server 2000

??? ??? ???????? ??? ?????? ??? ???? ???? ???? ?? Microsoft SQL Server 2000. ?????? ??? ??????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
290211INF: ????? ?????? ??? ???? ???? ???? ??????? SQL Server 2000

SQL Server 7.0

??????? ?????? ??? ??? ??????? ?? ?????? ????? ??? ??????? ???????? SQL Server.

Microsoft Data Access Components (MDAC)

??? ??? ???????? ??? ?????? ??? ???? ???? ???? ?? Microsoft ?????? Access ?????? 2.6. ?????? ??? ??????? ??????? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ?? Microsoft:
300635INFO: ????? ?????? ??? ???? MDAC 2.6 ???? ???????

?????

???? Microsoft ?? ??? ????? ?? ?????? Microsoft ??????? ?? ????? ??? ???????.

SQL Server 2000

?? ????? ??? ??????? ???? ??? ?? SQL Server 2000 Service Pack 1.

Microsoft Data Access Components (MDAC)

?? ????? ??? ??????? ???? ??? ?? Microsoft ?????? Access ?????? 2.6 ?????? ????? ?????? Service Pack 1.

??????? ????

????? ????? ????? ??????

  1. ?? ???? ???????? ???????? ??????? ?? ??? .cpp ????:
    #include <windows.h>
    #include <stdio.h>
    #include <tchar.h>
    
    #include "sql.h"
    #include "sqlext.h"
    #include "odbcss.h"
    
    int main()
        {
        // ODBC handles
        SQLHENV     henv = NULL;
        SQLHDBC     hdbc = NULL;
        SQLHSTMT    hstmt = NULL;
    
    	char szData[100];
    	short l;
     	//These must be modified for your specific DSN
        PTSTR       szDataSource = _T("localserver");
        PTSTR       szUID = _T("UserName");
        PTSTR       szPWD = _T("Password");
    
    	PTSTR		szDropTable = _T("if exists (select * from dbo.sysobjects where id = object_id(N'[my.table]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [my.table]");
    	PTSTR		szCreateTable = _T("Create Table [my.table] (col1 int)");
    	PTSTR       szSQLSelect = _T("Select * from dbo.[my.table]");
    
        // Initialize the ODBC environment.
        if (SQLAllocHandle(SQL_HANDLE_ENV, NULL, &henv) == SQL_ERROR)
            goto EXIT;
    
        SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*) SQL_OV_ODBC3, SQL_IS_INTEGER);
    
        // Allocate a connection handle and connect to the data source.
        if (SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc) == SQL_ERROR)
            goto EXIT;
    
        if (SQLConnect(hdbc, (SQLTCHAR*) szDataSource, SQL_NTS, (SQLTCHAR*) szUID, SQL_NTS, (SQLTCHAR*) szPWD, SQL_NTS) == SQL_ERROR)
            goto EXIT;
    
        // Get a statement handle and execute a Transact-SQL SELECT statement.
        if (SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt) == SQL_ERROR)
            goto EXIT;
    
    	if(SQLSetScrollOptions( hstmt, SQL_CONCUR_VALUES, SQL_SCROLL_DYNAMIC, 1) == SQL_ERROR)
    		goto EXIT;
    
    	if (SQLExecDirect(hstmt, (SQLTCHAR*) szDropTable, SQL_NTS) == SQL_ERROR)
            goto EXIT;
    
    	if (SQLExecDirect(hstmt, (SQLTCHAR*) szCreateTable, SQL_NTS) == SQL_ERROR)
            goto EXIT;
    
    
    	if (SQLExecDirect(hstmt, (SQLTCHAR*) szSQLSelect, SQL_NTS) == SQL_ERROR)
            goto EXIT;
    
    
    
    	if (SQLColAttribute(hstmt, 1, SQL_DESC_SCHEMA_NAME , &szData, 100, &l, NULL) ==SQL_ERROR)
    		goto EXIT;
    
    	_tprintf(_T("SQL_DESC_SCHEMA_NAME = %s, should be dbo\n"),szData);
    
    	if (SQLColAttribute(hstmt, 1, SQL_DESC_TABLE_NAME , &szData, 100, &l, NULL) ==SQL_ERROR)
    		goto EXIT;
    
    	_tprintf(_T("SQL_DESC_TABLE_NAME = %s, should be my.table\n"),szData);
    
    	if (SQLColAttribute(hstmt, 1, SQL_DESC_BASE_TABLE_NAME , &szData, 100, &l, NULL) ==SQL_ERROR)
    		goto EXIT;
    
    	_tprintf(_T("SQL_DESC_BASE_TABLE_NAME = %s, should be my.table\n"),szData);
    
    	if (SQLColAttribute(hstmt, 1, SQL_DESC_CATALOG_NAME, &szData, 100, &l, NULL) ==SQL_ERROR)
    		goto EXIT;
    
    	_tprintf(_T("SQL_DESC_CATALOG_NAME = %s, should be database specified in dsn\n"),szData);
    
    EXIT:
        if (hstmt != NULL)
            {
            SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
            }
    
        if (hdbc != NULL)
            {
            SQLDisconnect(hdbc);
            SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
            }
    
        if (henv != NULL)
            {
            SQLFreeHandle(SQL_HANDLE_ENV, henv);
            }
    
        return (0);
        }
    					
  2. ????? ????????? ???????? ????????. ???? ??????? ??? ???:
    SQL_DESC_SCHEMA_NAME = my, should be dbo
    SQL_DESC_TABLE_NAME = table, should be my.table
    SQL_DESC_BASE_TABLE_NAME = table, should be my.table
    SQL_DESC_CATALOG_NAME = dbo, should be database specified in dsn
    					

???????

???? ???????: 290646 - ????? ??? ??????: 06/?????/1424 - ??????: 3.2
????? ???
  • Microsoft SQL Server 7.0 Standard Edition
  • Microsoft SQL Server 2000 Standard Edition
????? ??????: 
kbmt kbbug kbfix kbmdac260sp1fix kbsqlserv2000sp1fix KB290646 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????290646

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com