12.33

Cara mendapatkan DBMS, User database melalui ODBC

/*Buat external function*/
FUNCTION integer SQLGetInfo (long hconn, integer infotype, ref string infotypeptr, integer bufferlength, ref integer bufferlengthptr) LIBRARY "odbc32.dll"

/*Buat script*/
string ls_dbms, ls_database, ls_user
integer li_length

CONSTANT integer SQL_DBMS_NAME = 17
CONSTANT integer SQL_DATABASE_NAME = 16
CONSTANT integer SQL_USER_NAME = 47

long ll_dbhandle

ls_dbms = space(256)
ls_database = space(256)
ls_user = space(256)
ll_dbhandle = SQLCA.DbHandle()

SQLGetInfo(ll_dbhandle, SQL_DBMS_NAME, ls_dbms, 255, li_length)
SQLGetInfo(ll_dbhandle, SQL_DATABASE_NAME, ls_database, 255, li_length)
SQLGetInfo(ll_dbhandle, SQL_USER_NAME, ls_user, 255, li_length)

MessageBox("Current DBMS" , trim(ls_dbms))
MessageBox("Current DATABASE" , trim(ls_database))
MessageBox("Current USER" , trim(ls_user))

0 komentar:

Posting Komentar