473,386 Members | 2,129 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.

simple syntax question

DataRow dataRow = dataSet.Tables[0].Rows[0];
string myString = dataRow["MY_COLUMN_NAME"].ToString();

Make sure you have at least one row before you try this.

Arthur
-----Original Message-----
Hi Roger,
Thanks for the try ... I get error that Rows not memeber
of TableName. I tried various other combinations using
your format ... but no luck. All I want to do is access
a data item (without using a control) via code so that I
can compare/list/calculate/etc. within my program code.
I filled the dataset using a SQLAdapter ... but simply
don't know how to programatically get to the data. An
other ideas are certainly appreciated.
Thanks!
-----Original Message-----
Try:

DsName.TableName("TableAlias").Rows(i).Items

("ColumnName")

Where i is the row number of the table you are after.
ColumnName would be the actual column name from your
orginal table.

Hope I understood your question correctly.

Another Rookie
-----Original Message-----
I am trying to access a column within a dataset. I candisplay data thru control but when trying to access viacode:
MessageBox.Show(DsName.TableName ("ColumnName").ToString)
I get the following error:

An unhandled exception of
type 'System.InvalidCastException' occurred in
microsoft.visualbasic.dll

Additional information: Cast from string "Status" to
type 'Integer' is not valid.

Can someone give me correct syntax or code example ...
Thanks!
A rookie
.

.

.

Jul 19 '05 #1
0 1325

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

Similar topics

10
by: martin | last post by:
Hello, I just got the SUN Java IDE. (Netbeans IDE 3.5.1) Very very nice, and I worked myself through the tutorial (about making a colorswitch). Now, When I compile it gives no errors at all. So...
27
by: Brian Sabbey | last post by:
Here is a first draft of a PEP for thunks. Please let me know what you think. If there is a positive response, I will create a real PEP. I made a patch that implements thunks as described here....
2
by: Trimbitas Sorin | last post by:
Hello I have a simple syntax question : What does the following line mean: 1: %checkType; ?? I know that @test="" is an array and $test="" is a simple variable. Thank you With best regards...
5
by: Greg Smith | last post by:
I am sure this is very simple but I can't seem to get the syntax correct. I have a class that I added to my application and I would like to reference controls on a webform. Something like: ...
6
by: Ted | last post by:
Here is one such function: CREATE FUNCTION my_max_market_date () RETURNS datetime BEGIN DECLARE @mmmd AS datetime; SELECT max(h_market_date) INTO @mmmd FROM holdings_tmp; RETURN @mmmd; END ...
14
by: dba_222 | last post by:
Dear experts, Again, sorry to bother you again with such a seemingly dumb question, but I'm having some really mysterious results here. ie. Create procedure the_test As
5
by: Hakusa | last post by:
I have the argument items in my class room. class room: def __init__(self, name, description, items*): I thought I remembered from a tutorial I read once, and I've read so many I feel like an...
27
by: Paulo da Silva | last post by:
Hi! I was told in this NG that string is obsolet. I should use str methods. So, how do I join a list of strings delimited by a given char, let's say ','? Old way:
17
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /*...
6
by: Eric | last post by:
I'm learning Python (while coming from MATLAB). One question I have is that if I have a list with say 8 elements, and I want just a few of them how do I select them out. In MATLAB, if I just want...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
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
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...

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.