51Testing软件测试论坛
标题:
Loadrunner代码问题
[打印本页]
作者:
yu8891617647
时间:
2010-9-17 20:20
标题:
Loadrunner代码问题
前边是我现在录制的脚本当中取任务信息的代码并没有全贴上来,最后面有我所遇到的问题。
lr.log("Event 803: SqlConnection_4.Open();");
SqlConnection_4.Open();
lr.log("Event 804: new SqlDataAdapter();");
SqlDataAdapter_4 = new SqlDataAdapter();
lr.log("Event 805: new SqlCommand(\"proc_task_getbatch\", SqlConnection_4);");
SqlCommand_4 = new SqlCommand("proc_task_getbatch", SqlConnection_4);
lr.log("Event 806: SqlCommand_4.CommandType = CommandType.StoredProcedure;");
SqlCommand_4.CommandType = CommandType.StoredProcedure;
lr.log("Event 807: ((String)(SqlParameter_1.Value));");
StringRetVal = ((String)(SqlParameter_1.Value));
lr.log("Event 808: SqlCommand_4.Parameters;");
SqlParameterCollection_1 = SqlCommand_4.Parameters;
lr.log("Event 809: SqlParameterCollection_1.Add(SqlParameter_1);");
SqlParameter_1 = SqlParameterCollection_1.Add(SqlParameter_1);
lr.log("Event 810: ((String)(SqlParameter_2.Value));");
StringRetVal = ((String)(SqlParameter_2.Value));
lr.log("Event 811: SqlParameterCollection_1.Add(SqlParameter_2);");
SqlParameter_2 = SqlParameterCollection_1.Add(SqlParameter_2);
lr.log("Event 812: SqlDataAdapter_4.SelectCommand = SqlCommand_4;");
SqlDataAdapter_4.SelectCommand = SqlCommand_4;
lr.log("Event 813: SqlDataAdapter_4.Fill(DataSet_3, \"ds\");");
// For data set named DataSet_3:
// No tables found
Int32RetVal = SqlDataAdapter_4.Fill(DataSet_3, "ds");
// For data set named DataSet_3:
DATASET_XML(4);
以上部分的程序能够获得packid和batchid,在程序的后半部分能够要用到这些信息,现在的问题是如何和能够从程序当中取出这些信息,添加到后边的程序当中。
这个的packdid是001201008020139 batchid001201008020139003
还有一个图像名称是'04KANTO_SCB03_20100802110647_20100802_99999999_000002。
所要用到这些信息的程序如下:
String value_80;
value_80 = "INSERT INTO IMS_TAB_001_INPUT_DATA(DATA_PROJECTID,DATA_PACKID,DATA_BA" +
"TCHID,DATA_SETID,DATA_FILESEQ,DATA_FILEID,DATA_GROUPNO,DATA_ROWNO,DAT" +
"A_ACCEFORMID,DATA_ACCEFIELDID,DATA_IMAGEID,DATA_ACCETYPEID,DATA_600,D" +
"ATA_600_FLAG) VALUES(N'001',N'001201008020139',N'001201008020139003'," + //这行用到这些信息
"N'2',2,N'04KANTO_SCB03_20100802110647_20100802_99999999_000002.JPG',N" +
"'1',N'1',N'H1_2',N'届先電話番号',N'147',N'H1',N'03-5968-8239','1')";
lr.log("Event 1692: SqlCommand_15.CommandText = value_80;");
SqlCommand_15.CommandText = value_80;
lr.log("Event 1693: SqlCommand_15.ExecuteNonQuery();");
Int32RetVal = SqlCommand_15.ExecuteNonQuery();
String value_81;
value_81 = "INSERT INTO IMS_TAB_001_INPUT_DATA(DATA_PROJECTID,DATA_PACKID,DATA_BA"+
"TCHID,DATA_SETID,DATA_FILESEQ,DATA_FILEID,DATA_GROUPNO,DATA_ROWNO,DAT"+
"A_ACCEFORMID,DATA_ACCEFIELDID,DATA_IMAGEID,DATA_ACCETYPEID,DATA_600,D" +
"ATA_600_FLAG) VALUE(N'001',N'001201008020139',N'001201008020139003',"+ //这行用到所取信息
"N'2',2,N'04KANTO_SCB03_20100802110647_20100802_99999999_000002.JPG',N" +
"'1',N'1',N'H1_2',N'商品\uFF7A\uFF70\uFF84\uFF9E',N'147',N'H1',N'61171231','1')";
lr.log("Event 1694: SqlCommand_15.CommandText = value_81;");
SqlCommand_15.CommandText = value_81;
lr.log("Event 1695: SqlCommand_15.ExecuteNonQuery();");
Int32RetVal = SqlCommand_15.ExecuteNonQuery();
程序的架构C/S,我选用的协议是.NET
而我现在的问题就是:
1: 如何从数据库中取出我所要的任务的信息,或者自动取到数据库中存有的任务信息。
2:如何把得到的信息参数化,并添加到后面的程序当中去。这些问题能否用参数化解决。
工作新人,现小白一个,求热心朋友解答~
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2