I created a stored procedure so as to return me a table something like that
create procedure sp_returnTable
body of procedure
select * from table
end
When i call this sp on frontend what code i need to write to retrieve it in a datatable object.
I wrote code something like this one. I basically want to know retrieving and storing table into an object of datatable. My all queries are running but i dont know how to retrieve table into a datatable thru stored procedure
DataTable dtable = new DataTable();
cmd.Connection = _CONN;
cmd.CommandText = SPNameOrQuery;
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter adp = new SqlDataAdapter(cmd);
OpenConnection();
adp.Fill(dtTable);
CloseConnection();
here in this code cmd has been binded with stored procedure name and its parameters. Will it be returning me a datatable from stored procedure