Results 1 to 8 of 8

Thread: Aren't all .NET projs use the same Framwork Classes??[Resolved]

  1. #1

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Talking Aren't all .NET projs use the same Framwork Classes??[Resolved]

    "C# OleDbDataReader Version "

    I couldn't find the property "Item" within this class ? I checked the documentation , it says , it's there ! Where the hell it's hiding ?
    I just checked Object browser and didn't find it there , Which one should I believe MSDN or OB ?

    what confuses me now is : I can view it in VB but not in C# !
    Last edited by Pirate; Mar 21st, 2003 at 05:40 PM.

  2. #2
    Hyperactive Member
    Join Date
    Feb 2002
    Posts
    261

    Re: Aren't all .NET projs use the same Framwork Classes??

    Originally posted by Pirate
    "C# OleDbDataReader Version "

    I couldn't find the property "Item" within this class ? I checked the documentation , it says , it's there ! Where the hell it's hiding ?
    I just checked Object browser and didn't find it there , Which one should I believe MSDN or OB ?

    what confuses me now is : I can view it in VB but not in C# !
    How are you using it in VB?

  3. #3

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    lol , of course this way !

    VB Code:
    1. Dim rd As OleDb.OleDbDataReader
    2. rd.Item(1)

  4. #4

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    paste this link in MSDN Help :

    ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemdataoledboledbdatareaderclassitemtopic.htm

  5. #5
    Hyperactive Member
    Join Date
    Feb 2002
    Posts
    261
    Originally posted by Pirate
    lol , of course this way !

    VB Code:
    1. Dim rd As OleDb.OleDbDataReader
    2. rd.Item(1)
    Sorry, I'm really not that familar with database stuff (never bothered to learn it yet).

    Hmm, when I set my MSDN filter to 'C# and Related', here's what I got for the Item property (Its quite different from VB's documentation):

    OleDbDataReader.Item Property [C#]See Also
    OleDbDataReader Class | OleDbDataReader Members | System.Data.OleDb Namespace
    Language
    C#

    C++

    JScript

    Visual Basic

    Show All
    Gets the value of a column in its native format.

    [C#] In C#, this property is the indexer for the OleDbDataReader class.

    Overload List
    Gets the value of the specified column in its native format given the column name.

    [Visual Basic] Overloads Public Default ReadOnly Property Item(String) As Object Implements IDataRecord.Item
    [C#] public object this[string] {get;}
    [C++] public: __property Object* get_Item(String*);
    [JScript] OleDbDataReader.Item (String)
    Gets the value of the specified column in its native format given the column ordinal.

    [Visual Basic] Overloads Public Default ReadOnly Property Item(Integer) As Object Implements IDataRecord.Item
    [C#] public object this[int] {get;}
    [C++] public: __property Object* get_Item(int);
    [JScript] OleDbDataReader.Item (int)
    See Also
    OleDbDataReader Class | OleDbDataReader Members | System.Data.OleDb Namespace


    --------------------------------------------------------------------------------

    Send comments on this topic.

    © 2001 Microsoft Corporation. All rights reserved.
    Hmm, It'll be easier to read if you checked with MSDN yourself. However, this is indeed very odd.

  6. #6

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    It's . I think it has to do with this indexer thing , what the hell is that anyways ?

  7. #7
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fort Collins, CO
    Posts
    366
    An indexer in C# is equivalent to the Item property in VB.NET.
    e.g.
    VB Code:
    1. Dim sColName As String
    2. Dim dr As SqlDataReader
    3. ' datareader initialized and loaded up here.
    4. sColName = dr.Item("ColName").ToString()

    in c# you'd use the following
    PHP Code:
    string sColName;
    SqlDataReader dr;
    sColName dr["ColName"].ToString() 
    if you're used to vb 6.0 it's similar to the setting up the Item property of a collection as the default property:
    VB Code:
    1. MyCollection.Item(0)
    2. 'if Item was the default property for MyCollection then the following would be equal
    3. MyCollection(0)

  8. #8

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Never mind , figured it out ! I've used GetValue , it suppose to work the same as Item in VB.NET version !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width