How to pass Parameters and Stored Procedure using Linq
ExecuteFunction executes stored procedure with specified parameters.This function accepts 2 parameters i.e stored procedure name and parameter list.
public List<GetCustomerSearchResult_Result> SearchCustomerMobileList(Int32 cbstr, string txtstr, int minLimit, int maxlimit)
{
var pars = new ObjectParameter[] {new ObjectParameter (@"criteria", cbstr), new ObjectParameter(@"searchValue", txtstr)
, new ObjectParameter(@"MinLimit", minLimit), new ObjectParameter(@"MaxLimit", maxlimit)};
return objPHQEntities.ExecuteFunction<GetCustomerSearchResult_Result>("GetCustomerSearchResult", pars).ToList<GetCustomerSearchResult_Result>();//GetCustomerSearchResult is stored procedure name and pars is a parameter list
}
0 Comment(s)