Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ODP.NET GetString exception: Column contains NULL data

1,783 views
Skip to first unread message

Omid Golban

unread,
Jun 2, 2003, 1:01:49 AM6/2/03
to
Hello,

I have problem with my 1st simple program.
I have successfully executed an SQL statement & the result is in OracleDataReader rd.
It holds 1 record with 4 columns. The 3rd column has a null value.
I can get the data out of the other columns with no problem, but the null value gives this exception.
The code is:
If Not IsDBNull(rd.GetString(2)) Then <---- This line generates the error
If _Employee_Name <> "" Then _Employee_Name &= " "
_Employee_Name &= rd.GetString(2)
End If

The exception is:
System.InvalidCastException: Column contains NULL data
at Oracle.DataAccess.Client.OracleDataReader.GetString(Int32 i)
at EzClasses.cSCT.set_EmpNo(String Value) in C:\Omid\VB .NET\Ezware\EzClasses\cSCT.vb:line 133

How do I take care of this?

Thank you,
Omid


karthick_g

unread,
Jul 24, 2003, 5:25:51 PM7/24/03
to

Try this one


If Not IsDBNull(rd.GetString(2)) Then "" Then _Employee_Name &= " "
_Employee_Name &= System.Convert.ToString(rd(2))
End If

karthi

--
Posted via http://dbforums.com

0 new messages