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
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