Mitesh Mistry

Mitesh Mistry

  • 1.6k
  • 138
  • 2.8k

Pass SqlParameter array in Web Serivce Method call

Jun 11 2015 1:21 AM
Hello ,
I am trying to call method whose parameter is storedprocedurename and sqlparameter array For example
 
 
Method Defination :
 
[WebMethod]
public DataSet GetDetail(string strProcedureName, CommandType strCommandType)
{
strCommandType = CommandType.StoredProcedure;
DataSet objGetResult = ConnectionClass.Select(strProcedureName, strCommandType);
return objGetResult;
}
 
 
 
 
Method Call :
 
localhost.SqlParameter[] param = new localhost.SqlParameter[2];
param[0] = new localhost.SqlParameter("KeyWord", SqlDbType.NVarChar);
param[0].Value = "Testing"
param[1] = new localhost.SqlParameter("PageSize", SqlDbType.Int);
param[1].Value = 20;
var objGetDetail = Obj1.GetDetail("SP_Related", param).Tables[0];
 
 
When i call like this we get error :
'localhost.SqlParameter' does not contain a constructor that takes 2 arguments
 
 
Please give any suggetion for this problem
 
 
 
 

Answers (2)