473,748 Members | 2,502 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1971
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.publi c.dotnet.datato ols
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: Guinness Mann <GM***@dublin.c om>
| Newsgroups: microsoft.publi c.dotnet.genera l
| Subject: Lightweight Table Access (ADO.NET)
| Date: Mon, 29 Sep 2003 11:37:29 -0700
| Organization: Dublin Brewery
| Lines: 20
| Message-ID: <MP************ ************@ne ws.newsguy.com>
| NNTP-Posting-Host: p-029.newsdawg.co m
| X-Newsreader: MicroPlanet Gravity v2.60
| Path:
cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!new sfeed00.sul.t-online.de!t-onlin
e.de!skynet.be! skynet.be!skyne t.be!skynet.be! feed1.news.be.e asynet.net!news .
moat.net!news-out.newsfeeds.c om!propagator2-maxim!news-in-maxim.spamkille r.n
et!news.he.net! cyclone-sf.pbi.net!129. 250.175.17!pln-w!spln!dex!extr a.newsgu
y.com!newsp.new sguy.com!enews4
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:110275
| X-Tomcat-NG: microsoft.publi c.dotnet.genera l
|
| 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
20352
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 Type = Value List. Row Source = "1; "Above"; 2; "Below"; 3; "Equal"". When I try to SELECT <field> FROM <table> in my C++ application through ADO, I get numeric value of the field. How can I get string representation of this numeric value from the...
17
4090
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 backend-database. After generating this table, I want to open a report based on a query with data from this temporary table. In the report's OnOpen event I set the report's record source to the query pointing to the temporary table. If I run...
4
13468
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 Excel on his machine and then press a button or something and append that data to the Access table on the network? Any suggestions on what the code would be? Thank you very much! Martin
2
9954
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 from this view in SQL server. However, in access, I have a form/subform that displays the records but when I try to edit I get the message "Form is read-only, because the unique table property is not set." If I remove one of the tables from the...
6
1663
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 of other calls, to no avail. Below is sample code. Could someone provide:
5
6441
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 solution: 1. I am not allowed to use ODBC 2. I have to use ADO 3. I am not allowed to use Linked tables
1
271
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 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
3
10322
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 A. (Must Lock the table A) 2. Open table B and update table B.
5
2099
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, I need to update the table links so that the paths are correct for the install directory. Is there an easy way to accomplish this? I'd really like to avoid duplicating the data in the linked tables, but if updating the links is too much work,...
0
8826
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9534
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9316
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.