Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INT field in data reader
Message
From
29/05/2003 14:10:54
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00794078
Message ID:
00794084
Views:
22
Dmitry,


I haven't used a DataReader, so I'm not 100% sure, but I wouldn't imagine it would be any different than anything else. Try leaving off the ToString() and casting it to int:
int MyField = (int)drMyTable["fld_name"];
~~Bonnie


>I was wondering, how do you get an int type field from a data reader.
>
>For example, I can get a string type field (or int type) from a data reader (e.g. drMyTable) as a string:
>
>
>string MyField = drMyTable["fld_name"].ToString();
>
>
>But if the field "fld_name" is INT, do I have to still get it as a string and then convert to INT? Is there a way to do it right from the dr?
>
>TIA.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform