473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

C#:App:How to navigate through records in a dataset/datatable

hi
i have a form with First,Next,Prev,Buttons.
i had populated a datatable with datas .Now i need to navigate through the records , can any body help me how to achieve this.

Expand|Select|Wrap|Line Numbers
  1.                conn = new SqlConnection(connstr);
  2.                 conn.Open();
  3.                 SqlCommand cmd = new SqlCommand(sqlAllCustomers, conn);
  4.                 SqlDataAdapter adpt = new SqlDataAdapter(cmd);
  5.                 DataTable dtCust1 = new DataTable("CustomerDatTab");
  6.                 adpt.Fill(dtCust1);
  7.  
thanks in adv
sk
Jan 9 '08 #1
2 8424
Hello,

You can retrieve the particular row of datatable wirh the index of row as datarow.
for e.g.,

dtCust1.Rows[0][0].ToString();

This will return the first element of first row.
You can navigate by adding and substracting the first 0.

Just xpand your logic you will find the way...

Paresh

ds.


hi
i have a form with First,Next,Prev,Buttons.
i had populated a datatable with datas .Now i need to navigate through the records , can any body help me how to achieve this.

Expand|Select|Wrap|Line Numbers
  1.                conn = new SqlConnection(connstr);
  2.                 conn.Open();
  3.                 SqlCommand cmd = new SqlCommand(sqlAllCustomers, conn);
  4.                 SqlDataAdapter adpt = new SqlDataAdapter(cmd);
  5.                 DataTable dtCust1 = new DataTable("CustomerDatTab");
  6.                 adpt.Fill(dtCust1);
  7.  
thanks in adv
sk
Jan 9 '08 #2
hi
paresh
Thanku its working fine.

also one more doubt, is this the best way than using the CurrencyManage?
since in my search a way of using the Currency manager to navingate recs.

thanks
sk
Jan 9 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jon Moldover | last post by:
Hi, I'm using Python in my win32 app by linking to the python23.dll. I'm trying to expose some c++ code in my app to Python so I can make application calls from Python scripts (according to the...
3
by: Bob | last post by:
I haver a user login form (winforms app using vs2005 in VB.NET). After succesfull validayion of user I want to open a first form and close the loging form that was used, If I write If...
13
by: muskan | last post by:
hello, Can u tell me how we can retrieve the records from the database.
7
AHayes
by: AHayes | last post by:
I've been searching online for a while now with no luck, so I'll try the friendly folk here. _The Problem I have a dataset/dataview that's getting its data from an XML file (which we're using...
2
by: ssknov | last post by:
hi all i need to retrieve the row values from a database thru dataset, for the CELL VALUE CLICKED IN DATAGRIDVIEW. the datagrid view is already populated from the same table with the single...
5
nirmalsingh
by: nirmalsingh | last post by:
hai all, i want to set color for datatable cells.and assign it to dataset,and to datagrid view. my doubt is , how to apply color for the datatable cells. thanx in advance with Cheers Nirmal
1
nev
by: nev | last post by:
Good day Sirs & Madams, I know some of you will find this problem very simple. Kindly share a little knowledge to me on how to deal with this. Thank you. I have a parent-child table relation. when...
3
by: dmj07 | last post by:
Hi, I need some help in creating a dataset that I can bind to a datalist after it has added a set of strings to it: DataSet ds = new DataSet(); DataTable dt = new DataTable("table");...
5
by: dmj07 | last post by:
Hi, My need is to set the font colour of a data row before it is bound to a datalist depending on whether it meets the conditions of an if statement. Here is my code: DataSet ds = new...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.