MYSQL格式:(本地需要安装MYSQL ODBC DRIVER)
Dim Cnn
Set Cnn = CreateObject("ADODB.Connection")
Cnn.ConnectionString ="DATABASE=testmysql;DSN=192.168.1.63;OPTION=0WD=123456ORT=0;SERVER=192.168.1.63;UID=root"
Cnn.Open
If Cnn.State = 0 Then
Reporter.ReportEvent micFail, "testing", "连接数据库失败"
else
Reporter.ReportEvent micPass, "testing", "连接数据库成功"
end if
2.本地已创建数据源的方式
DSN=数据源名称;UID=用户名WD=密码;DBQ=数据库名;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;GDE=F;FRL=F;BAM=IfAllSuccessful;MTS=F;MDI=F;CSR=F;FWC=FFC=10;TLO=0;
实例:
DSN=dcworkoracle;UID=DCWORK;DBQ=DCWORK;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;GDE=F;FRL=F;BAM=IfAllSuccessful;MTS=F;MDI=F;CSR=F;FWC=FFC=10;TLO=0;
3.SQL语句实例
source:SQL语句
SELECT HR_LANGUAGE_TYPE.LANGUAGE_NAME FROM DCWORK.HR_LANGUAGE_TYPE HR_LANGUAGE_TYPE WHERE (HR_LANGUAGE_TYPE.LANGUAGE_NAME='中文') ORDER BY HR_LANGUAGE_TYPE.LANGUAGE_NAME作者: mylaurel 时间: 2009-7-7 23:53
thanks,study