for(int p=0; p<dsForumList; p++)
    {   
     dsForumList="select ForumName from KF_Fourms";
      {   
        if(dsForumList.Tables.Count > 0)
           {
             if (dsForumList.Tables[0].Rows.Count > 
               {
                  for (int i = 0; i < dsForumList.Tables[0].Rows.Count; i++)
                      {
                          strForumName = Convert.ToString(dsForumList.Tables[0].Rows[i]["ForumName"]);

                              // strForumName =Convert.ToString (dsForumList .Tables [0].Rows[i]["ForumName"]);
                              for (int j = 0; j < dsCategoryList.Tables[0].Rows.Count; j++)
                                   {
                                      //intCategoryID = Convert.ToInt32(ds.Tables[0].Rows[i]["CategoryID"]);
                                      strCategoryName = Convert.ToString(dsCategoryList.Tables[0].Rows[j]["CategoryName"]);
                                   }
                      }
              }   
      }
 } for(int p=0; p<dsForumList; p++)
    {   
     dsForumList="select ForumName from KF_Fourms";
      {   
        if(dsForumList.Tables.Count > 0)
           {
             if (dsForumList.Tables[0].Rows.Count > 
               {
                  for (int i = 0; i < dsForumList.Tables[0].Rows.Count; i++)
                      {
                          strForumName = Convert.ToString(dsForumList.Tables[0].Rows[i]["ForumName"]);

                              // strForumName =Convert.ToString (dsForumList .Tables [0].Rows[i]["ForumName"]);
                              for (int j = 0; j < dsCategoryList.Tables[0].Rows.Count; j++)
                                   {
                                      //intCategoryID = Convert.ToInt32(ds.Tables[0].Rows[i]["CategoryID"]);
                                      strCategoryName = Convert.ToString(dsCategoryList.Tables[0].Rows[j]["CategoryName"]);
                                   }
                      }
              }   
      }
 }

the basic code to retrieve data to a dataset is like this.

SqlConnection conn = new SqlConnection("ConnectionString");
DataSet ds = new DataSet();
String sqlStatement = "Select FIelds From Table";
SqlDataAdapter adapt = new SqlDataAdapter(sqlStatement, conn);
adapt.Fill(ds);

now you have you result set into the dataset, then you can play with it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.