Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INT field in Dataset
Message
 
To
27/01/2009 15:54:37
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01377516
Message ID:
01377533
Views:
18
>I have a SQL table that I gather a dataset from. Included in the dataset are values from INT fields. 2 of the fields I use to reposition a textbox on the form. The only way I can make this happen is as follows:
>
>txtbudfc1.Location = new System.Drawing.Point( int.Parse(dsx.Tables[0].Rows[0]["udfc1txtbxloc"].ToString()),
> int.Parse(dsx.Tables[0].Rows[0]["udfc1txtbyloc"].ToString()));
>
>I assume there is a better way than "int.parse(table.row.fieldname.tostring())" conversion. Is there a simple way to get the INT value from the dataset object?
>

Yes, just do a direct cast to "int" instead of converting it to a string, then back into an int.

Replace this:
int.Parse(dsx.Tables[0].Rows[0]["udfc1txtbxloc"].ToString())
With
(int) dsx.Tables[0].Rows[0]["udfc1txtbxloc"]
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform