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

A better way to refer to DB columns?

Right now, I'm pulling data from a db, attaching it to a ds, then navigating
the ds to build HTML to spit out to the page. My calls to the individual
columns are like this:

ds.Tables(0).Rows(rowCount).Item(1).ToString)

This works but as I change things, it gets a bit akward to have to keep
going back to count the number of items to match the item(x) call.

Is there a way to call these columns by name rather than by count?

-Darrel

Nov 18 '05 #1
3 949
Darrel wrote:
Right now, I'm pulling data from a db, attaching it to a ds, then navigating
the ds to build HTML to spit out to the page. My calls to the individual
columns are like this:

ds.Tables(0).Rows(rowCount).Item(1).ToString)

This works but as I change things, it gets a bit akward to have to keep
going back to count the number of items to match the item(x) call.

Is there a way to call these columns by name rather than by count?


Sure:

ds.Tables(0).Rows(rowCount)("ColumnName")

Happy Programming!

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
Nov 18 '05 #2
> ds.Tables(0).Rows(rowCount)("ColumnName")

Dammit. It's that simple?

I feel dumb now. ;o)

Thanks! ;o)

-Darrel
Nov 18 '05 #3
It gets even better than Scott's response. Look into typed datasets.

Tom Dacon
Dacon Software Consulting

"Darrel" <no*****@nospam.com> wrote in message
news:u0**************@TK2MSFTNGP15.phx.gbl...
Right now, I'm pulling data from a db, attaching it to a ds, then
navigating
the ds to build HTML to spit out to the page. My calls to the individual
columns are like this:

ds.Tables(0).Rows(rowCount).Item(1).ToString)

This works but as I change things, it gets a bit akward to have to keep
going back to count the number of items to match the item(x) call.

Is there a way to call these columns by name rather than by count?

-Darrel

Nov 18 '05 #4

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

Similar topics

3
by: KULJEET | last post by:
foreign key also refer to unique constraint. (GREAT...) 1.then table that containt unique constraint act as master table????? 2.IS unique constraint will replace with primary key?? 3.Is unique...
22
by: David Sterling | last post by:
After much futzing about with the XML/XSD for the Search.Response, I had to resort to this... PLEASE Tell me there is a better way! private void ExecuteAQuery(string strLookingForWhat) {...
1
by: Jason | last post by:
Hi all, I have 1 table which need to store 7 days data in a row, I not sure which table design will gain better performance in SELECT statement. Desgin 1. 7 columns (day1, ..., day7) with char(4)...
14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
1
by: Morten Snedker | last post by:
I have a datagrid with multiple columns. Clicking one column header makes it sort. Clicking again makes a reverse sorting. But also I want to show the correct little image in the header,...
6
by: Terry Olsen | last post by:
I loaded my datagrid. Now I need to step through the rows & columns to parse the data contained in the cells. But there's no "rows.count" or "columns.count" properties to read. How can I know...
5
by: serge | last post by:
Is it generally or almost always better to have multiple small SPs and functions to return a result set instead of using a single big 1000+ lines SP? I have one SP for example that is 1000+...
39
by: windandwaves | last post by:
Hi Folk I have to store up to eight boolean bits of information about an item in my database. e.g. with restaurant drive-through facility yellow windows
15
by: Rob Meade | last post by:
Hi all, I have a databse which I'm pulling the data from for my ASP page. I have 4 tables, Course, Feature, Objective, and PreRequisite. The last three all contain a course product code and a...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.