Problem with System.DBNull

  • Thread starter Thread starter Philip Tepedino
  • Start date Start date
P

Philip Tepedino

Hi,

I'm trying to read a few values with tmp = SqlCmd.ExecuteScalar()
If tmp = null (or in this case, System.DBNull), keep going, else, run some stuff.
I'm having a problem finding, and skipping fields that are null.
I've tried the following:

If tmp.GetType.ToString <> "System.DBNull" Then
....
End If

This works, however, it generates an exception later on in my program. (the next time I call form.show() for any form)
....
An unhandled exception of type 'System.OutOfMemoryException' occurred in system.windows.forms.dll

Additional information: Error creating window handle.
....

Is there a correct way of doing this?

Thanks,

Philip Tepedino
Siemens Westinghouse Generation Services
(e-mail address removed)
 
I would use the IsDBNull function but I'm not sure it will change the
exception.

If it still fails, post perhaps rather the line where you actually have this
exception rather than assuming it comes from this test (basically you would
create something several times exhausting memory ?)

Patrice

--

"Philip Tepedino" <[email protected]> a écrit dans le message de
Hi,

I'm trying to read a few values with tmp = SqlCmd.ExecuteScalar()
If tmp = null (or in this case, System.DBNull), keep going, else, run some
stuff.
I'm having a problem finding, and skipping fields that are null.
I've tried the following:

If tmp.GetType.ToString <> "System.DBNull" Then
....
End If

This works, however, it generates an exception later on in my program. (the
next time I call form.show() for any form)
....
An unhandled exception of type 'System.OutOfMemoryException' occurred in
system.windows.forms.dll

Additional information: Error creating window handle.
....

Is there a correct way of doing this?

Thanks,

Philip Tepedino
Siemens Westinghouse Generation Services
(e-mail address removed)
 
Look at IsDbNull or DBNull.Value


Hi,

I'm trying to read a few values with tmp = SqlCmd.ExecuteScalar()
If tmp = null (or in this case, System.DBNull), keep going, else, run some stuff.
I'm having a problem finding, and skipping fields that are null.
I've tried the following:

If tmp.GetType.ToString <> "System.DBNull" Then
...
End If

This works, however, it generates an exception later on in my program. (the next time I call form.show() for any form)
...
An unhandled exception of type 'System.OutOfMemoryException' occurred in system.windows.forms.dll

Additional information: Error creating window handle.
...

Is there a correct way of doing this?

Thanks,

Philip Tepedino
Siemens Westinghouse Generation Services
(e-mail address removed)
 
http://www.knowdotnet.com/testsite/nullvalues.html
Look at IsDbNull or DBNull.Value


Hi,

I'm trying to read a few values with tmp = SqlCmd.ExecuteScalar()
If tmp = null (or in this case, System.DBNull), keep going, else, run some stuff.
I'm having a problem finding, and skipping fields that are null.
I've tried the following:

If tmp.GetType.ToString <> "System.DBNull" Then
...
End If

This works, however, it generates an exception later on in my program. (the next time I call form.show() for any form)
...
An unhandled exception of type 'System.OutOfMemoryException' occurred in system.windows.forms.dll

Additional information: Error creating window handle.
...

Is there a correct way of doing this?

Thanks,

Philip Tepedino
Siemens Westinghouse Generation Services
(e-mail address removed)
 
Back
Top