Question : Reader.GetString Receives Conversion Error in vb.net

Hi,

I have been working through converting from VB to VB.net (VS 2005).  I am trying to use the Oracle client with the reader.  I am using the following code:

1500:       SQL = "SELECT CLASSID, SHORTDESC " & _
                    "FROM TBFEGCLASSIFICATION " & _
                "ORDER BY RANKING"

1600:       cmd = New Oracle.DataAccess.Client.OracleCommand(SQL, cnIQR)

1700:       rsIQ = cmd.ExecuteReader()

1800:       If rsIQ.HasRows Then
1900:           Do While rsIQ.Read()
2100:               lstEntry.Name = rsIQ.GetString("SHORTDESC")
2200:               lstEntry.ID = rsIQ.GetInt16("CLASSID")
2700:           Loop
2800:       End If

2900:       rsIQ.Close()

Where ShortDesc is varchar(20) and ClassID is Number.  The code as written receives the following error:
Conversion from string "SHORTDESC" to type 'Integer' is not valid on the right side of the line 2100.

I don't see where there is an attempt to convert a string to an integer.  If I change it to rsIQ.Item("SHORTDESC") there is no error.  I read that it is more efficient to use GetString than Item.

Can someone explain the error?  Thanks a bunch!

Answer : Reader.GetString Receives Conversion Error in vb.net

Hm.. Does the rsIQ.GetString method take a column name as an argument or a column number?
Random Solutions  
 
programming4us programming4us