No, my point is you could not do anything that would mean getting the column
value from the datareader.
The mere call to dr1("catnum") raises the error. There is no row - so no
column value for "catnum" - because there is no row!!
That's why the if statement for dr1.Read - to make sure there is a row
before you try to look at one of its columns.
<da*****@msn.com> wrote in message
news:ok********************************@4ax.com...
oops my bad you could do it as
dr1("catnum") is nothing
On Thu, 26 Jun 2003 16:10:41 -0400, "Marina"
<zl*******@nospam.hotmail.com> wrote:
There is no point to doing that. dr1.Read returned false - hence no
rows.Neither of these things will work. The structure needs to be
If dr1.Read() Then
If IsDbNull(dr1("Catnum") Then
....
End If
End If
<da*****@msn.com> wrote in message
news:h0********************************@4ax.com.. . There is a difference between dbnull and the object being null. You
also need to check if the object doesn't exists as well
if not dr1("Catnum") is vbnullstring orelse isdbnull(dr1("catnum")
then
-dwayne
On Thu, 26 Jun 2003 15:47:53 -0400, "Helixpoint" <da**@helixpoint.com>
wrote:
>I get an error when it checks for NULL???
>
>
>
>"Marina" <zl*******@nospam.hotmail.com> wrote in message
>news:un**************@tk2msftngp13.phx.gbl...
>> If you figured out that no rows were returned, then what's the
problem? >>
>> "Helixpoint" <da**@helixpoint.com> wrote in message
>> news:OT**************@TK2MSFTNGP10.phx.gbl...
>> > Not to be a jerk, but I figured that out.
>> >
>> >
>> > "Marina" <zl*******@nospam.hotmail.com> wrote in message
>> > news:us**************@TK2MSFTNGP11.phx.gbl...
>> > > Looks like there were no rows returned. dr1.Read returned false.
>> > >
>> > > "Helixpoint" <da**@helixpoint.com> wrote in message
>> > > news:Oy**************@tk2msftngp13.phx.gbl...
>> > > > Dim dr1 As SqlDataReader =
>> MachCodeListID.GetSingleMachCode(thecodesID)
>> > > >
>> > > > ' Read first row from database
>> > > >
>> > > > dr1.Read()
>> > > >
>> > > > If IsDBNull(dr1("CATNUM")) Then '**************** This is
where Iam >> > > getting
>> > > > the error??????
>> > > >
>> > > > thecatnum = 0
>> > > >
>> > > > Else
>> > > >
>> > > > thecatnum = dr1("CATNUM")
>> > > >
>> > > > End If
>> > > >
>> > > >
>> > > > --
>> > > >
>> > > > ______________________
>> > > > David Fetrow
>> > > > HelixPoint LLC.
>> > > > http://www.helixpoint.com
>> > > > da***@helixpoint.com
>> > > >
>> > > > Interested in Affordable Email Marketing?
>> > > > Check out the HelixMailer at
>http://www.helixpoint.com/helixmailer.asp
>> > > > If you are interested in becoming a Reseller of HelixPoint
products, >> > > contact
>> > > > da***@helixpoint.com
>> > > > ______________________
>> > > >
>> > > >
>> > >
>> > >
>> >
>> >
>>
>>
>