clearcase/" target="_blank" >cccccc>using System; using System.Runtime.InteropServices; using System.ComponentModel; using System.Data; using System.Data.OracleClient; using ShangXin.Data; using System.Collections; using System.Web;
namespace LoadRunnerUser { /// <summary> /// Summary description for VuserClass. /// </summary> [ClassInterface(ClassInterfaceType.AutoDual)] public class VuserClass { LoadRunner.LrApi lr; protected System.Data.OracleClient.OracleDataAdapter oracleDA; protected System.Data.OracleClient.OracleCommand loadCommand; protected System.Data.OracleClient.OracleConnection oracleConnection;
public VuserClass() { // LoadRunner Standard API Interface :: DO NOT REMOVE!!! lr = new LoadRunner.LrApi(); }
protected System.Data.OracleClient.OracleConnection GetOracleConnection()////sqlConnection { if (oracleConnection==null) oracleConnection=new System.Data.OracleClient.OracleConnection(); oracleConnection.ConnectionString="User Id=test;Password=write;Data Source=escalade"; return oracleConnection; }
// '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' public int Initialize() { // TO DO: Add virtual user's initialization routines
return lr.PASS; }
// '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' public int Actions() { try {
lr.start_transaction("TestGetWithDrawOrderByCode"); System.Data.OracleClient.OracleConnection conn = new OracleConnection("User Id=test;Password=write;Data Source=escalade"); System.Data.OracleClient.OracleCommand comm = new OracleCommand(); comm.Connection = conn; comm.CommandText = "BILL.GetWithDrawOrderByCode"; comm.CommandType = CommandType.StoredProcedure; //输入参数 System.Data.OracleClient.OracleParameter param1=comm.Parameters.Add("V_CODE",OracleType.VarChar,20); param1.Direction = ParameterDirection.Input; param1.Value ="TH15"; //输出参数 System.Data.OracleClient.OracleParameter param2=comm.Parameters.Add("RETCURSOR",OracleType.Cursor); param2.Direction = ParameterDirection.Output;
DataTable dt = new DataTable(); oracleDA = new System.Data.OracleClient.OracleDataAdapter(); oracleDA.SelectCommand = comm; oracleDA.Fill(dt); int iCount=Convert.ToInt32(dt.Rows.Count.ToString()); if(iCount>0) lr.end_transaction("TestGetWithDrawOrderByCode",lr.PASS); else lr.end_transaction("TestGetWithDrawOrderByCode",lr.FAIL);
}
catch(Exception ex) { string error = ex.Message; }
return lr.PASS; }
// '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' public int Terminate() { // TO DO: Add virtual user's termination routines
return lr.PASS; }
} } |