QTP不同数据库检查点手动SQL写法(转)
QTP插入数据库检查点,手动指定SQL语句的写法。一、SQL Server格式(本地无需安装SQL Server)
connectionstring(连接字符串):
1.本地没有创建数据源的方式
DRIVER=SQL Server;SERVER=数据库IP地址;UID=用户名;PWD=密码;APP=Microsoft Office 2003;WSID=本地主机名;DATABASE=数据库名
实例:
DRIVER=SQL Server;SERVER=10.160.11.10;UID=sa;PWD=sa;APP=Microsoft Office 2003;WSID=RJHLJUN;DATABASE=dcwork
2.本地已创建数据源的方式
DSN=数据源名称;UID=用户名;PWD=密码;APP=Microsoft Office 2003;WSID=数据库的主机名;DATABASE=数据库名
实例:
DSN=LocalServer;UID=sa;PWD=sa;APP=Microsoft Office 2003;WSID=RJDCWORKTEST;DATABASE=dcwork
3.SQL语句实例(从数据库表HR_LANGUAGE_TYPE中,查询字段语言名称LANGUAGE_NAME,条件语言名称=中文,按语言名称升序排序结果)
source(SQL语句):
SELECT HR_LANGUAGE_TYPE.LANGUAGE_NAMEFROM dcwork.dbo.HR_LANGUAGE_TYPE HR_LANGUAGE_TYPEWHERE (HR_LANGUAGE_TYPE.LANGUAGE_NAME='中文')ORDER BY HR_LANGUAGE_TYPE.LANGUAGE_NAME
二、DB2格式:(本地至少安装DB2 Run-Time Client Lite)
connectionstring(连接字符串):
1.本地没有创建数据源的方式
DRIVER={IBM DB2 ODBC DRIVER};UID=用户名;PWD=密码;MODE=SHARE;DBALIAS=数据库名;
实例:
DRIVER={IBM DB2 ODBC DRIVER};UID=db2admin;PWD=db2admin;MODE=SHARE;DBALIAS=DCWORK;
2.本地已创建数据源的方式
DSN=数据源名称;UID=用户名;PWD=密码;MODE=SHARE;DBALIAS=DCWORK;
实例:
DSN=DWCORKDB2;UID=db2admin;PWD=db2admin;MODE=SHARE;DBALIAS=DCWORK;
3.SQL语句实例
source:SQL语句
SELECT HR_LANGUAGE_TYPE.LANGUAGE_NAMEFROM DB2ADMIN.HR_LANGUAGE_TYPE HR_LANGUAGE_TYPEWHERE (HR_LANGUAGE_TYPE.LANGUAGE_NAME='中文')ORDER BY HR_LANGUAGE_TYPE.LANGUAGE_NAME
三、Oracle格式:(本地需要安装Oracle ODBC DRIVER)
connectionstring(连接字符串):
1.本地没有创建数据源的方式
DRIVER={Oracle in OraHome92};SERVER=数据库服务名;UID=用户名;PWD=密码;DBQ=数据库名;DBA=W;APA=T;EXC=F;XSM=Default;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;GDE=F;FRL=Lo;BAM=IfAllSuccessful;MTS=F;MDI=Me;CSR=F;FWC=F;PFC=10;TLO=O;
实例:
DRIVER={Oracle in OraHome92};SERVER=DCWORK;UID=DCWORK;PWD=DCWORK;DBQ=DCWORK;DBA=W;APA=T;EXC=F;XSM=Default;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;GDE=F;FRL=Lo;BAM=IfAllSuccessful;MTS=F;MDI=Me;CSR=F;FWC=F;PFC=10;TLO=O;
2.本地已创建数据源的方式
DSN=数据源名称;UID=用户名;PWD=密码;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=F;PFC=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=F;PFC=10;TLO=0;
3.SQL语句实例
source:SQL语句
SELECT HR_LANGUAGE_TYPE.LANGUAGE_NAMEFROM DCWORK.HR_LANGUAGE_TYPE HR_LANGUAGE_TYPEWHERE (HR_LANGUAGE_TYPE.LANGUAGE_NAME='中文')ORDER BY HR_LANGUAGE_TYPE.LANGUAGE_NAME 有没有mysql的? Dim Cnn, Rst, strCnn
strCnn = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=discuz;USER=root;Option=3"
Set Cnn = CreateObject("ADODB.connection")
Cnn.Open strCnn
Set Rst = CreateObject("ADODB.Recordset")
Rst.Open "select * from cdb_posts", Cnn
Rst.MoveFirst
While Rst.EOF <> True
MsgBox Rst.Fields("subject") & Chr(13) & Chr(10) & Rst.Fields("message") & Chr(13) & Chr(10)
Rst.MoveNext
Wend
Rst.Close
Cnn.Close
Set Rst = Nothing
Set Cnn = Nothing 原帖由 TIB 于 2010-4-15 21:45 发表 http://bbs.51testing.com/images/common/back.gif
Dim Cnn, Rst, strCnn
strCnn = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=discuz;USER=root;Option=3"
Set Cnn = CreateObject("ADODB.connection")
Cnn.Open strCnn
Set Rst = CreateObj ...
嘿嘿,谢谢啦
页:
[1]