473,416 Members | 1,660 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,416 software developers and data experts.

Lightweight Table Access (ADO.NET)

Greetings,

I'm working in VS2003.NET using C#.

I need to download a few rows from an SQL Server database table and then
be able to page back and forth through them. I don't need to make any
changes nor post any updates.

In the past I've downloaded the rows using a datareader, copied the
fields for each row into a structure and then added the structure to an
arrayList.

That works ok, but I was wondering about populating a datatable instead.
Looking at a datatable, though I don't see any getNext(), getPrev(), etc
functions, so I don't see what that would buy me.

Any thoughts?

-- Rick

Jul 21 '05 #1
1 1936
Hi Rick,

If you use a data table, each row is accessible by index (just like an
array list). There is no concept of "current" index, however, so you would
need to keep track of this yourself. Once you have this, implementing a
getNext or getPrev method is fairly simple (increment or decrement the
current index value).

The syntax for doing this on a data table is:

dataTable.Rows[i][columnName]

where i is the index and columnName is the name of a column in that row.

If you use this mechanism, you can avoid having to manually read the data
in from the data reader and define your own structure to contain the row
data. However, you may find that the data reader implementation is more
efficient than building a whole data table for it.

Hope this helps,
VSData Team
Please post to our newsgroup: microsoft.public.dotnet.datatools
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: Guinness Mann <GM***@dublin.com>
| Newsgroups: microsoft.public.dotnet.general
| Subject: Lightweight Table Access (ADO.NET)
| Date: Mon, 29 Sep 2003 11:37:29 -0700
| Organization: Dublin Brewery
| Lines: 20
| Message-ID: <MP************************@news.newsguy.com>
| NNTP-Posting-Host: p-029.newsdawg.com
| X-Newsreader: MicroPlanet Gravity v2.60
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed 00.sul.t-online.de!t-onlin
e.de!skynet.be!skynet.be!skynet.be!skynet.be!feed1 .news.be.easynet.net!news.
moat.net!news-out.newsfeeds.com!propagator2-maxim!news-in-maxim.spamkiller.n
et!news.he.net!cyclone-sf.pbi.net!129.250.175.17!pln-w!spln!dex!extra.newsgu
y.com!newsp.newsguy.com!enews4
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:110275
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| Greetings,
|
| I'm working in VS2003.NET using C#.
|
| I need to download a few rows from an SQL Server database table and then
| be able to page back and forth through them. I don't need to make any
| changes nor post any updates.
|
| In the past I've downloaded the rows using a datareader, copied the
| fields for each row into a structure and then added the structure to an
| arrayList.
|
| That works ok, but I was wondering about populating a datatable instead.
| Looking at a datatable, though I don't see any getNext(), getPrev(), etc
| functions, so I don't see what that would buy me.
|
| Any thoughts?
|
| -- Rick
|
|

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Vladimir | last post by:
Hello, I have a table in MS Access database. It has one field (with BYTE datatype) that has several properties set in Lookup tab of table Design View. Display Control = Combo Box. Row Source...
17
by: Jon Ole Hedne | last post by:
I have worked on this problem some hours now (read many-many...), and I can't solve it: In vba-code I create a table with Connection.Execute, and add some data to it. This table is saved in the...
4
by: Martin | last post by:
There is an Access table on the network. 15 users who do not have Access are connected to the network. Is there a way for each user to be able to enter one or more rows containing 3 or 4 columns to...
2
by: Bill Holmes | last post by:
I have an A2003 front end (mdb) using ado to link the form/subforms to SQL server 2k tables and views. In SQL server, there is a view between 2 tables with a 1-1 relationship. I can edit records...
6
by: amywolfie | last post by:
Hi all: I am using Access 2002, and of course, when I copied the solution from the Solutions.mdb to link tables at startup, I got an area using the code supplied. I have since tried a variety...
5
by: Fabrice | last post by:
Hello everybody, I'm working with Access 2002. I have to import Data from a Foxpro table that contains 25000 records in an Access table. I have a couple of restrictions placed on me for the...
1
by: Guinness Mann | last post by:
Greetings, I'm working in VS2003.NET using C#. I need to download a few rows from an SQL Server database table and then be able to page back and forth through them. I don't need to make any...
3
by: equalive | last post by:
Hi guys, I'm having problem locking a table in Ms Access using VB6 code. Actually I have 3 tables. Assume table names is A, B, C. Following is the process. 1. Open table A and update table...
5
by: aaron.m.johnson | last post by:
I have an application which contains an Access database with linked tables that point to another database within the application. The problem I have is that when the user installs the application,...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.