Hi,
can anybody tell me how to covert Dataset to Datatable and then link DataTable to the stored procedure.
I dont want to write select query in the data Access layer. Instead i want to access stored procedure in DAL and populate selected tables in the grid.
Below is my Stored Procedure and code in Data access layer:
SP:
CREATE PROCEDURE [apqcstars].[SHR_Select_TemplateListByUser]
@USER_ID VARCHAR(40)
AS
BEGIN
SELECT
StudentHistoryTemplateID, TemplateName, CreatedBy, CreatedDate, ShowComment, IsPrivate, ClassSchedule, CustomGroupID, RosterID, PrintGroup, IsTemporary
FROM
StudentHistoryTemplate
WHERE
CreatedBy = @USER_ID
DAL:
public DataSet GetSHTemplateListByUserDA(string strUserID)
{
SqlCommand objSqlCommand = Execute.GetCommandObject();
objSqlCommand.CommandText = "SHR_Select_TemplateListByUser";
objSqlCommand.Parameters.AddWithValue("@USER_ID",strUserID);
objSqlCommand.CommandType = CommandType.StoredProcedure;
return Execute.ExecuteDataset(objSqlCommand);
I want to display only 3 columns of the table in the SP. How do i do that?
Thanks,
Arun