Retrieving data value

fkheng

Well-known member
Joined
May 8, 2003
Messages
155
Location
Malaysia
Apart from obtaining a value using blabla.getString(0) for example, are there other ways of obtaining it (other syntax?) for example by specifying the field name instead?
 
Well what is blahbla? Is that a xxxDataReader or..? You can use xxxDataReader["column"]; (note that it returns an object)
 
yeap
it is a datareader
i see...
thanx, just found out that i can do the same with a datarow in a dataset...

er.....i have another question

dr("UserName") = DirectCast(dr("UserName"), String).ToUpper

dr is a datarow

in my db, username is declared as a text type
is it necessary to convert it to a string type?
can i directly use it?
 
i see, so a data field in a datarow is generally viewed as an object?
so the field type which i state in the ms access database is not recognised in .net till i convert it?
like in my case, the field is of a text type in the database table, but i have to convert it to string before i can use it?
 
I ment to cast it before using it, by that I mean manipulating the data in some way or to perform calculations. If you just want the value then object.ToString() should work (like Robby said)
 
Back
Top