Converting VB.NET to C#.NET

Z

zacks

I am converting a VB.NET application to C#.NET and I have ran into a
situation that I cannot so far find an answer to. Retrieving data with
an ODBCDataReader, I could issue a rdr.Read method call and then
refernce the columns with the rdr("columnname") function. Seems that
C# does not allow access to the resultset row data using the column
name. rdr.GetString(0) seems to work. Is this a limitation in C#?
 
A

Alberto Poblacion

I am converting a VB.NET application to C#.NET and I have ran into a
situation that I cannot so far find an answer to. Retrieving data with
an ODBCDataReader, I could issue a rdr.Read method call and then
refernce the columns with the rdr("columnname") function. Seems that
C# does not allow access to the resultset row data using the column
name. rdr.GetString(0) seems to work. Is this a limitation in C#?

In C# you have to use sqare brackets ["columnname"] instead of the round
parenthesis ("columnname").
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top