Object Datatype Conversion

Hamsagins

New Member
I'd just like to say a big thankyou to Scott Mitchell for answering some of my previous queries. Thanks Scott !<BR><BR>I am using C# and an OleDbDataReader, unlike vb.net c# doesnt expose an .Item() method which usually converts the object to its correct data type leaving me with the painful exercise of trying to convert it manually. At the moment i convert each item to a string so i can then convert that to an Int32,<BR><BR> ie : Session["userid"] = Int32.Parse(reader["userid"].ToString());<BR><BR> this also generates the problem of what to do if the field is null which causes Int32 to throw an exception. Is there an easy way to convert the field into its correct datatype ?<BR><BR>Thanks,<BR><BR><BR>Miles
 
Back
Top