在WR里面怎么写数据查询?
Declare @ProjectName varchar(200),@ProjectID int,@FileSystemID intDeclare @FileName varchar(200)
set @ProjectName = 'izAM8Wk8ZkXy'
set @FileName='Design'
set @ProjectID = (select ProjectID_int from project where ProjectName_vchar=@ProjectName)
set @FileSYstemID = (select FileSystemID_int
from FileSystemProjectRelation
where ProjectID_int=@ProjectID)
select F.FileSystemID_int,S.FileSystemName_vchar
from FileSystem_FindChildren_fn(@FileSYstemID) F
inner join FileSystem S on F.FileSystemID_int=S.FileSystemID_int
where isNull(S.FileItemID_int,0)=0 AND S.FileSystemName_vchar=@FileName
这段在WR里面应该怎么写?
db_connect("query1",DSN);
中间这里应该怎么写?
db_disconnect(DSN);
[ 本帖最后由 lxhcba 于 2005-11-29 09:07 编辑 ] rc=db_connect("timogen","DSN=timogen;UID=iim3;PWD=iim3;APP=WinRunner;WSID=catherine_zhang;DATABASE=tdm",30);
if (rc!= E_OK )
pause("connect fail");
r1=db_execute_query("timogen","update purchase_order set open_quantity=0 where po_system_id='po_sys_121' ",Count1);
参考一下下面的代码。不过要事先在odbc里设置好数据库 一句话的我也会,可是一段带变量的我就不知道怎么办了 Item="item_iid";
rc=db_connect("timogen","DSN=timogen;UID=iim3;PWD=iim3;APP=WinRunner;WSID=catherine_zhang;DATABASE=tdm",30);
if (rc!= E_OK )
pause("connect fail");
r=db_execute_query("timogen","select "&Item&" from item",i);
if(r!=E_OK)
pause("Update fail!");
db_disconnect("timogen");
你说的是这个意思吗,sql语句只是一个字符串,你用变量代替是可以的啊 试过了,不行阿
where部分含字符串变量应该这样来写!
也许你问的问题和我问的一样,即如何处理查询中where部分含有字符串变量的问题。现在我的问题自己解决了,故写出分享,要特别注意里面的引号。
strWhere="where string";
sql="select * from where SomeField='"&strwhere&"'";
db_execute_query("query1",sql,record_number); 受教了。学了一招。
页:
[1]