Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am gathering a set of information from users and they are : name,rollnum,fathername,dept,branch,Sem and gender. When user enters this information and click button SubCode, SubTitle has to be fetched based of Dept,Branch and Sem entered by the user from the other table for which I have written a Query and it is working fine.
Defination of table (TblSub)
HTML
SubCode   |SubTitle         |Dept              |Branch           |Sem
C1        C Programming      Computer Science  Computer Science   1
J1        Java Programming   Computer Science  Computer Science   1
J1        C++ Programming    Computer Science  Computer Science   2

Now my main problem is I want to display (rollnum,Name,Fathername,SubCode,SubTitle) in a gridview.
Output of the gridview has to look like this when user select dept=branch=Computer Science and sem = 1
HTML
rollnum     |Name    |Fathername   |SubCode   |SubTitle 
01           stud1    father1        C1        C Programming
01           stud1    father1        J1        Java Programming

The number of subcode differs to each student based on the dept,branch and sem they select. I tot of using dataset where I will 1st enter rollnum,name,fathername and then add column subcode and subtitle column wise. But as the number of subcode differs for each student I not getting how to achieve this. I will be glad to know if there is any other way other then dataset which is more convenient in using. Please help. Thank you.
Posted
Updated 5-Jun-15 20:52pm
v3

1 solution

C#
static DataSet ds_input = new DataSet();
static DataSet ds_output = new DataSet();

private static void InitializeMyDataSet()
{
    ds_output.Tables.Add(new DataTable() );
    ds_output.Tables[0].Columns.Add("column_1", typeof(string));
    ds_output.Tables[0].Columns.Add("column_2", typeof(string));
    ds_output.Tables[0].Columns.Add("column_4", typeof(string));
    ds_output.Tables[0].Columns.Add("column_3", typeof(string));
}
 
Share this answer
 
v3
Comments
partha143 6-Jun-15 3:39am    
How to merge two dataset?? I want the same numbers of rows of dataset1 = number of rows in dataset2.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900