473,763 Members | 5,396 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 1973
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
20355
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
4091
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
9955
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
1665
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
6443
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
10324
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
2100
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
9564
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9387
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
9823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
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
7368
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
6643
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
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...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2794
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.