ODP.NET GetString exception: Column contains NULL data
From: Omid Golban <ogolban_at_socal.rr.com>
Date: Mon, 02 Jun 2003 05:01:49 GMT
Message-ID: <1TACa.48793$x67.2132622_at_twister.socal.rr.com>
Hello,
Date: Mon, 02 Jun 2003 05:01:49 GMT
Message-ID: <1TACa.48793$x67.2132622_at_twister.socal.rr.com>
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
Received on Mon Jun 02 2003 - 07:01:49 CEST