fkheng Posted June 14, 2003 Posted June 14, 2003 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? Quote Can you bind the beautiful Pleiades, and can you loose the cords of Orion? - God to Job...
Moderators Robby Posted June 14, 2003 Moderators Posted June 14, 2003 Do you mean the value field of say a dropdown? If so, use the SelectedItem.Value method. Quote Visit...Bassic Software
fkheng Posted June 14, 2003 Author Posted June 14, 2003 er......not a dropdown but a value from a database field... Quote Can you bind the beautiful Pleiades, and can you loose the cords of Orion? - God to Job...
wyrd Posted June 14, 2003 Posted June 14, 2003 Well what is blahbla? Is that a xxxDataReader or..? You can use xxxDataReader["column"]; (note that it returns an object) Quote Gamer extraordinaire. Programmer wannabe.
fkheng Posted June 15, 2003 Author Posted June 15, 2003 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? Quote Can you bind the beautiful Pleiades, and can you loose the cords of Orion? - God to Job...
wyrd Posted June 15, 2003 Posted June 15, 2003 If DataRow["column"] returns an object, then yes you should cast it before using it. Quote Gamer extraordinaire. Programmer wannabe.
Moderators Robby Posted June 15, 2003 Moderators Posted June 15, 2003 You can just use .ToString without the cast Quote Visit...Bassic Software
fkheng Posted June 15, 2003 Author Posted June 15, 2003 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? Quote Can you bind the beautiful Pleiades, and can you loose the cords of Orion? - God to Job...
wyrd Posted June 15, 2003 Posted June 15, 2003 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) Quote Gamer extraordinaire. Programmer wannabe.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.