Amjad,
This is the WRONG way to use ADO.NET to make a stored procedure call!
You are using the Language path through SQL Server, and you want to use the
RPC path instead.
1) Create a SqlCommand object, set it's CommandText property to the name of
the stored proc, and it's CommandType property to StoredProcedure.
2) Create a SqlParameter object for each named parameter, assign it the
actual parameter value, and add the Parameter to the SqlCommand's Parameters
collection.
3) Assign the Command to the SelectCommand property of the DataAdapter and
continue as you did before.
--Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"amjad" wrote:
i am posting below code i am not sure how to call parametrized store
procedure and fill the grid.
...
I have store procedure which pull the info from sql server 2005 using
asp.net 1.1... that proc accept two parameters .
any body has any idea how to do that thing using dataset ....
thanks
public DataSet GetCustByDate(int MonthNo,string YearNo)
{
strSQL="dbo.sp_GetCust " + MonthNo.ToString() + " , " + YearNo;
SqlConnection conn = this.GetConnection();
conn.Open();
SqlDataAdapter myCommand = new SqlDataAdapter(strSQL, conn);
DataSet ds = new DataSet();
myCommand.Fill(ds, strSQL);
conn.Close();
return ds;
}