vc中oracle如何通过odbc数据源名取得对应数据库名?
解决方案 »
- 刚开始学习Orge引擎遇到的头疼的问题。。。很急。。。在线等。。。
- 请问,函数/线程中,如果检查函数返回值有错误,继续执行也是错的,这时该怎么办?
- CreateDIBSection创建HBITMAP大小问题???急!!!!
- 中间件几问
- 复合控件从atl3转换到atl7求助, 急!!!
- 请问怎么将CString转成in_addr呢?多谢了!
- 请问如何在windows下动态改变桌面图片
- InstallShield 7 中怎么定义包的图标?
- 请问刷新函数RefreshData()在哪里加入
- MessageBox显示!
- 怎么把几个exe文件做成一个安装包,也就是setup?(急!!!)
- vc中ms sql server如何通过odbc数据源名取得对应数据库名?
SQLHDBC ConnectionHandle,
SQLUSMALLINT InfoType,
SQLPOINTER InfoValuePtr,
SQLSMALLINT BufferLength,
SQLSMALLINT * StringLengthPtr);SQLUSMALLINT InfoType:
SQL_DATA_SOURCE_NAME returns the value passed as DSN to SQLConnect, or SQLDriverConnect; returns an empty string if no DSN is specified.
SQL_DATA_SOURCE_READ_ONLY returns 'N'.
SQL_DATABASE_NAME returns a full UNC path to the current database if the data source is a database. If the data source connects to a directory of tables, the function returns the path to the directory.
SQL_DBMS_NAME returns "Visual FoxPro".
SQL_DBMS_VER returns "03.00.0000".
SQL_DEFAULT_TXN_ISOLATION returns SQL_TXN_READ_COMMITTED. Dirty reads are not possible, but nonrepeatable reads and phantoms are possible.
SQL_DRIVER_HDBC is implemented by the Driver Manager.
SQL_DRIVER_HENV is implemented by the Driver Manager.
SQL_DRIVER_HLIB is implemented by the Driver Manager.
SQL_DRIVER_HSTMT is implemented by the Driver Manager.
SQL_DRIVER_NAME returns "vfpodbc.dll".
SQL_DRIVER_ODBC_VER returns "02.50" (SQL_SPEC_MAJOR, SQL_SPEC_MINOR).
SQL_DRIVER_VER returns "01.00.0000".
更多的内容参考MSDN给出你具体用法:
/*===================================
函数功能:得到当前连接的数据源名称信息
====================================*/
CString CLeftView::GetCurrentDBInfo(HDBC hdbc)
{
CString strCurDB;
char buf[200];
short num;
//获得当前连接数据库的信息
SQLGetInfo(hdbc,SQL_DATA_SOURCE_NAME,buf,sizeof(buf),&num);
strCurDB.Format("%s",buf);
return strCurDB;
}