Re: using string instead of int
- From: Hans Kesting <invalid.hansdk@xxxxxxxxxxxxxxx>
- Date: Wed, 19 Mar 2008 10:36:40 +0100
When your database column has an "int" type, you can easily do something like:
DataRow dr = MyDataSet.Rows[0];
int i = (int)dr["MyIntColumn"];
but this will fail if there are "null"s in that column (the field will then contain a DbNull.Value). In that case use this:
int ?i2 = dr["MyIntColumn"] as int?;
Hans Kesting
mavrick_101 explained :
Just to avoid unneccary Convet.ToInt32, while retrieving from an Int type column in table.
.
- References:
- Re: using string instead of int
- From: Seth Williams
- Re: using string instead of int
- Prev by Date: problem with DLL of ABC-Pdf
- Next by Date: framework design with portal and asp.net subsites
- Previous by thread: Re: using string instead of int
- Next by thread: using WSAT to manage multiple sites
- Index(es):
Relevant Pages
|