2 Replies - 13299 Views - Last Post: 06 January 2009 - 07:08 PM Rate Topic: -----

#1 ish*  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 37
  • Joined: 25-November 08

how to loop through Dataset in ASP.Net

Post icon  Posted 06 January 2009 - 12:24 AM

Hi.,
In my programme I read data from Database and store in the dataset. My code is as follows.

SqlConnection connection; 
connection = new SqlConnection(ConfigurationManager.ConnectionStrings["GamesConnection"].ConnectionString); 

connection.Open();
		SqlCommand cmd = new SqlCommand("Select gamePlatform from gameTable",connection);
		SqlDataAdapter ad = new SqlDataAdapter(cmd);
		ad.SelectCommand = cmd;
		DataSet ds = new DataSet();
		ad.Fill(ds);
		connection.Close();



But I want to store this data in variable/array. So for that I want to know how to loop through Dataset. I am looking for some help on that.
Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: how to loop through Dataset in ASP.Net

#2 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5796
  • View blog
  • Posts: 12,631
  • Joined: 16-October 07

Re: how to loop through Dataset in ASP.Net

Posted 06 January 2009 - 06:29 AM

A DataSet is a container. Inside that container, among other things, are DataTables. If your code worked, you should have at least one. Inside of a DataTable are DataRows. Each row has fields. More info, and probably the code you're looking for, here.

This post has been edited by baavgai: 06 January 2009 - 06:30 AM

Was This Post Helpful? 0
  • +
  • -

#3 ish*  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 37
  • Joined: 25-November 08

Re: how to loop through Dataset in ASP.Net

Posted 06 January 2009 - 07:08 PM

View Postbaavgai, on 6 Jan, 2009 - 05:29 AM, said:



Hi baavgai.,
Thanks for your answer. I checked the URL n the programe works fine.. Thanks... :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1