Checking for datareader returned types at runtime

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

dr is a dataset, str1 is a string. How can I know the type inside the
datareader field?
I tried:

if(dr.GetValue(n) is System.Int32)
str1=Convert.ToString(dr.GetSqlInt32(n))
else
str1=dr.GetString(n)

But the compiler warns the if is always false.
Thanks in advance
 
Back
Top