ForwardOnly/ReadOnly ADO Problem with SQL Joins

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default ForwardOnly/ReadOnly ADO Problem with SQL Joins

    I've recently come accross a strange problem. Everytime I attemp to
    open a ForwardOnly/ReadOnly recordset with any kind of a join in it, I
    can only retrieve the fields which i explicitly named in the select
    statement.

    Example:

    sSQL = "select a.*, b.field1 from...."
    oRs.Open sSQL, oConn, 0, 1
    -------------------------------------

    The only column i will be able to retrieve is the 'field1' column.
    The rest return nothing. Although, they don't return an error either,
    like it normally would if you'd put in a bad column name. If I change
    either the cursor type or the lock type, it returns correctly. If I
    connect to a different SQL server, it returns correctly. It also
    returns correctly from query analyzer. It seems like the SQL Server
    is the culprit, and not ADO, because i've tried connecting to the
    problem SQL server from 2 different web servers with the same results.
    Any ideas what could possibly cause this? And I realize I can get
    around this by explicitly declaring my columns, changing cursor/lock
    types or changing servers, but that would be difficult with that
    amount of pages and data we currently have. And it also wouldn't
    satisfy my intellectual curiousity.

    Thanks.
    Rick Roemer Guest

  2. Similar Questions and Discussions

    1. JOINs instead of AND
      Where do I go to learn how to do JOINs instead of using multiple ANDs in a WHERE clause? I hear a JOIN is faster, and I am all for speed in a query.
    2. Query problem - multiple left joins??
      I have an employee table, and an organization table. The employee table contains an ouID link which always has a match in the org.table. The...
    3. Collection Readonly
      I have a Web service with a serializable collection class. My test app can read the collection without any problems. The problem I'm having is...
    4. SQL help on joins
      I'm getting bogged down in figuring out how to do joins on 3 tables. The three tables are Institution, stats and signoff. Institution_ID is the...
    5. Help on Multiple JOINS
      Paul Eaton wrote: Yes, unless it's Access, which is really picky about using parentheses to group the joins. If you're using Access, use the...
  3. #2

    Default Re: ForwardOnly/ReadOnly ADO Problem with SQL Joins

    Rick Roemer wrote:
    > I've recently come accross a strange problem. Everytime I attemp to
    > open a ForwardOnly/ReadOnly recordset with any kind of a join in it, I
    > can only retrieve the fields which i explicitly named in the select
    > statement.
    The solution is simple, and is widely recommended as Good Programming
    Practice: do not use Select * in production queries. Always explicitly name
    all the fields you want the query to return.

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows [MVP] Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139