PC Review


Reply
Thread Tools Rate Thread

Converting VB.NET to C#.NET

 
 
zacks@construction-imaging.com
Guest
Posts: n/a
 
      26th Apr 2007
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#?

 
Reply With Quote
 
 
 
 
Alberto Poblacion
Guest
Posts: n/a
 
      26th Apr 2007

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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").

 
Reply With Quote
 
sloan
Guest
Posts: n/a
 
      26th Apr 2007
this is helpful for me
http://www.developerfusion.co.uk/uti...btocsharp.aspx

however, you'll have to watch the () vs [], the converter will screw those
up sometimes.






<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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#?
>



 
Reply With Quote
 
Marc Gravell
Guest
Posts: n/a
 
      26th Apr 2007
In C# indexers use square brackets; try rdr["columnname"]

Marc

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need some help converting this to C++ AA2e72E Microsoft C# .NET 2 5th Feb 2010 08:19 AM
Re: Converting .lib to .dll Neil Cowburn Microsoft Dot NET Compact Framework 11 19th Jun 2008 05:33 PM
Converting :mm:ss to ss Phredd Microsoft Excel Worksheet Functions 8 18th Jun 2008 07:25 PM
Converting a date to a text field w/o converting it to a julian da LynnMinn Microsoft Excel Worksheet Functions 2 6th Mar 2008 03:43 PM
help converting c# to c++? =?Utf-8?B?Sm9lbA==?= Microsoft Dot NET Framework 11 17th Aug 2006 08:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:45 AM.