kashif_82
08-06-2005, 11:35 AM
Hi, I am trying to read one row (it will only be one row based on Identity) and grabbing the data with DataReader:
cmd = NEW SQLCommand(sql, con)
'the rest of the code
dr = cmd.ExecuteReader
If dr.hasrows() then
dr.Read()
if NOT IsDbNull(dr("Name")) ANDALSO dr("Name").toString <> "" Then
Name= dr("Name").toString
End If
if NOT IsDbNull(dr("ShipAddress")) ANDALSO dr("ShippingAddress").toString <> "" Then
Address = dr("ShippingAddress").toString
End If
It works fine when it is grabbing the Name field but on ShippingAddress gives System.IndexOutOfRangeException. Both fields are nvarchar(50) and NON-NULL fields.
cmd = NEW SQLCommand(sql, con)
'the rest of the code
dr = cmd.ExecuteReader
If dr.hasrows() then
dr.Read()
if NOT IsDbNull(dr("Name")) ANDALSO dr("Name").toString <> "" Then
Name= dr("Name").toString
End If
if NOT IsDbNull(dr("ShipAddress")) ANDALSO dr("ShippingAddress").toString <> "" Then
Address = dr("ShippingAddress").toString
End If
It works fine when it is grabbing the Name field but on ShippingAddress gives System.IndexOutOfRangeException. Both fields are nvarchar(50) and NON-NULL fields.