using Dataset and DataTable to display selected columns

Posted by Arun11 under C# on 7/5/2011 | Points: 10 | Views : 1899 | Status : [Member] | Replies : 2
Hi,

Below is my code in the Data access layer to get a list of data from the database.

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);

Now the Stored Procedure "SHR_Select_TemplateListByUser" contains table with 8 columns.but, i want to display only 3 columns out of 8 in the radgrid.I think i need to convert Dataset to Datatable for this.So can anyone please tell me what code i need to add above.

many Thanks,
Arun




Responses

Posted by: Lakn2 on: 7/5/2011 [Member] Starter | Points: 25

Up
0
Down
hi what i understand your problem is two show 3 columns out of 8 columns for this why do you want to convert dataset to datatable ,i did n't understand

bind that dataset to gridview and display only columns that you want

Thanks&Regards
LakshmiNarayana Nalluri.

Arun11, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Arun11 on: 7/5/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

Thats what i am confused about.how to display only the columns that i want? and since i have used code in the DAL as mentioned above, what do i need to write in aspx.cs so that the required data is populated on the grid on page load?

Thanks,
Arun

Arun11, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response