连接数据库的方法
1.直接连接数据库
CODE:
SQLCA.DBMS="ODBC"
SQLCA.AUTOCOMMIT=FALSE
SQLCA.DBParm="Connectstring='DSN=text;UID=DBA;PWD=SQL'"
Connect;
If sqlca.sqlcode <> o then
messagebox("数据库连接失败",sqlca.sqlerrtext)
halt
end if
2.用"*.INI "文件连接数据库
INI文件格式:
[DATABASE]
dbms=odbc
database=text
userid=dba
dbpassword=sql
logid=
logpassword=
servername=
dbParm=connectstring='DSN=text'
-------------------------------------------------------
open 事件:
string Is_profile
Is_profile="config.ini"
sqlca.dbms=profilestring(Is_profile,"database","dbms","")
sqlca.database=profilestring(Is_profile,"database","database","")
sqlca.userid=profilestring(Is_profile,"database","userid","")
sqlca.logpass=profilestring(Is_profile,"database","logpassword","")
sqlca.dbParm=profilestring(Is_profile,"database","dbparm","")
-------------------------------------------------------