SQL_SUCCESS_WITH_INFO表示你已经一
只脚踏进了数据库,但是可能你的连接
字符串中有至少一个参数错误,所以又
被踢出来了。

解决方案 »

  1.   

    YOU CAN SEE BELOW INFORMATION FROM MSDN,YOU HAVE SUCCESSED!SQLBrowseConnect
    SQLBrowseConnect, like SQLDriverConnect, uses a connection string. However, by using SQLBrowseConnect, an application can construct a complete connection string iteratively with the data source at run time. This allows the application to do two things: Build its own dialog boxes to prompt for this information, thereby retaining control over its user interface.
    Browse the system for data sources that can be used by a particular driver, possibly in several steps. 
    For example, the user might first browse the network for servers and, after choosing a server, browse the server for databases accessible by the driver.When SQLBrowseConnect completes a successful connection, it returns a connection string that can be used on subsequent calls to SQLDriverConnect.The SQL Server ODBC driver always returns SQL_SUCCESS_WITH_INFO on a successful SQLConnect, SQLDriverConnect, or SQLBrowseConnect. When an ODBC application calls SQLGetDiagRec after getting SQL_SUCCESS_WITH_INFO, it can receive the following messages:5701Indicates that SQL Server put the user's context into the default database defined in the data source, or into the default database defined for the login ID used in the connection if the data source did not have a default database.5703Indicates the language being used on the server.The following example shows the message returned on a successful connection by the system administrator:szSqlState = "01000", *pfNativeError = 5701,
    szErrorMsg="[Microsoft][ODBC SQL Server Driver][SQL Server]
           Changed database context to 'pubs'."
    szSqlState = "01000", *pfNativeError = 5703,
    szErrorMsg="[Microsoft][ODBC SQL Server Driver][SQL Server]
           Changed language setting to 'us_english'."You can ignore messages 5701 and 5703; they are only informational. You should not, however, ignore a SQL_SUCCESS_WITH_INFO return code because messages other than 5701 or 5703 may be returned. For example, if a driver connects to a server running an instance of SQL Server with outdated catalog stored procedures, one of the errors returned through SQLGetDiagRec after a SQL_SUCCESS_WITH_INFO is:SqlState:   01000
    pfNative:   0
    szErrorMsg: "[Microsoft][ODBC SQL Server Driver]The ODBC
                catalog stored procedures installed on server
                my65server are version 06.50.0193; version 07.00.0205
                or later is required to ensure proper operation.
                Please contact your system administrator."The error handling function of an application for SQL Server connections should call SQLGetDiagRec until it returns SQL_NO_DATA. It should then act on any messages other than the ones with a pfNative code of 5701 or 5703.