Results 1 to 3 of 3

Thread: Make reference to a field in ADO

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Guadalajara, Jalisco, Mex
    Posts
    105

    Make reference to a field in ADO

    Hi everyone.

    How i do to make reference to fiel in ado that the name is like
    "MYTABLE.MYFIELD" ?

    if i put somethind like this

    dim rs as ADODB.RECORSET

    ' *** Initializes connection, ejecute the query, etc.
    .
    .
    .
    .
    x = rs("MYTABLE.MYFIELD")


    i get an error.

    If put this in the query: "MYTABLE.MYFIELD AS OTHERFIELD" and i make the
    reference like rs("OTHERFIELD") it's works, but i don?t wan to make it.
    it is the only way ?????

    Thanks

  2. #2
    Frenzied Member blindlizard's Avatar
    Join Date
    Feb 2001
    Location
    Austin, TX - United States of America
    Posts
    1,141
    You can use the index value, rs.Fields(0)

    Select field1, field2 from table

    rs.Fields(0) => field1
    rs.Fields(1) => field2
    I drink to make other people more interesting!
    [vbcode]On Error GoTo Bar[/vbcode]
    http://www.monsterlizard.com

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Unless you have more than on field by the same name (which I think might return an ADO error), just use the field name. No need to qualify it with the table name.
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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