I'm using the same code in my software and it works like a champ.
This leads me to believe that maybe you don't actually have a "Photo2"
column in your result set as you think you do.
Try this experiment, use the numeric index of the data column instead of the
column name, such as this:
If IsDBNull(dr1.Item(0)) Then...
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Wayne Wengert" <> wrote in message
news:...
> Yes, that code is in a read loop
>
> Wayne
>
> "Steve C. Orr [MVP, MCSD]" <> wrote in message
> news:...
>> Did you do a dr1.Read() first?
>>
>> --
>> I hope this helps,
>> Steve C. Orr, MCSD, MVP
>> http://SteveOrr.net
>>
>>
>> "Wayne Wengert" <> wrote in message
>> news:...
>> >I am using a datareader (dr1) to read through rows returned from a
>> >query.
> I
>> > am getting the error: "No data exists for the row/column." at the "If
>> > IsDbNull..." in the code below. The field "Photo1" does exist and in
> some
>> > rows it is null, in others it may be an empty string and in others it
> may
>> > have a file name. I don't understand exactly what the system is
>> > complaining
>> > about here?
>> >
>> > Wayne
>> >
>> >
>> >
>> > =========== code ============
>> > If IsDBNull(dr1.Item("Photo2")) Then
>> >
>> > txtPhoto2.Text = ""
>> >
>> > Else
>> >
>> > txtPhoto2.Text = dr1.Item("Photo2")
>> >
>> > End If
>> >
>> >
>>
>>
>
>