code timing out on select from access

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

  1. #1

    Default code timing out on select from access

    I am getting a timeout error and I'm not sure why. I have not called
    any data from a form on either post or get...(do I need to?) Any Idea
    why it isn't working and how to fix it?

    Thanks in advance!

    Here is my entire code:

    <%@LANGUAGE="JAVASCRIPT"%>

    <%

    var conn = Server.CreateObject("ADODB.Connection");
    var rs = Server.CreateObject("ADODB.Recordset");
    var sqlText = "SELECT DISTINCT Table1.*, Table2.* FROM Table2 INNER
    JOIN Table1 ON Table2.Unm = Table1.Unm WHERE Table1.Field1 =
    'something'";
    conn.Open("DSN=photo");
    rs.Open(sqlText,conn);

    while (!rs.EOF) {
    var f1 = rs.Fields("Field1").value;
    var f2 = rs.Fields("Field2").value;
    var f3 = rs.Fields("Field3").value;
    }

    rs.Close();
    conn.Close();

    Response.write (f1 + " " + f2 + " " + f3);

    %>
    Jeremy Guest

  2. Similar Questions and Discussions

    1. Select all checkboxes in datagrid via code
      Im doing this: private function selectAll():void { var length : int = myDataGrid.dataProvider.length; for( var i : int = 0; i < length; i++ ) {...
    2. Use MS Access to write SQL select statements
      Hello, I am not sure if this is common knowledge or not, but I just figured out how to use MS Access to write my sql select statements for me. ...
    3. HP Select Access
      Does anyone know anything about HP's OpenView Select Access? According to HP's website, it is 'Identity management software for secure user access...
    4. MS Access SQL: duplicate record... ?SELECT INTO....?
      What syntax would you use to dupe a record? Thanks! -- Scotter
    5. Access 2002 PDFWriter VBA Code w/WinXP does not work like Access 2000
      I am trying to print an Access 2002 report (Windows XP OS) as a PDF. I had success with Access 2000 in a Windows 2000 environment, but as soon as I...
  3. #2

    Default Re: code timing out on select from access


    Please disregard the var in front of the sqlText string...It isn't in
    the code (thus isn't what is causing the problem)

    Thanks again!




    *** Sent via Devdex [url]http://www.devdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Jeremy Zifchock Guest

  4. #3

    Default Re: code timing out on select from access

    Why are you using DISTINCT? Are you really going to have a join that
    produces duplicates? If so, why don't you have any primary keys?
    [url]http://www.aspfaq.com/2509[/url]
    [url]http://www.aspfaq.com/2504[/url]

    Why are you using SELECT *?
    [url]http://www.aspfaq.com/2096[/url]

    Why are you using ODBC and a DSN?
    [url]http://www.aspfaq.com/2126[/url]

    Why are you using an explicit ADODB.Recordset object?
    [url]http://www.aspfaq.com/2191[/url]

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    "Jeremy" <jeremy_zifchock@yahoo.com> wrote in message
    news:f9d85033.0407120540.2e8f01ed@posting.google.c om...
    > I am getting a timeout error and I'm not sure why. I have not called
    > any data from a form on either post or get...(do I need to?) Any Idea
    > why it isn't working and how to fix it?
    >
    > Thanks in advance!
    >
    > Here is my entire code:
    >
    > <%@LANGUAGE="JAVASCRIPT"%>
    >
    > <%
    >
    > var conn = Server.CreateObject("ADODB.Connection");
    > var rs = Server.CreateObject("ADODB.Recordset");
    > var sqlText = "SELECT DISTINCT Table1.*, Table2.* FROM Table2 INNER
    > JOIN Table1 ON Table2.Unm = Table1.Unm WHERE Table1.Field1 =
    > 'something'";
    > conn.Open("DSN=photo");
    > rs.Open(sqlText,conn);
    >
    > while (!rs.EOF) {
    > var f1 = rs.Fields("Field1").value;
    > var f2 = rs.Fields("Field2").value;
    > var f3 = rs.Fields("Field3").value;
    > }
    >
    > rs.Close();
    > conn.Close();
    >
    > Response.write (f1 + " " + f2 + " " + f3);
    >
    > %>

    Aaron [SQL Server MVP] Guest

  5. #4

    Default Re: code timing out on select from access

    Jeremy wrote:
    > I am getting a timeout error and I'm not sure why. I have not called
    > any data from a form on either post or get...(do I need to?) Any Idea
    > why it isn't working and how to fix it?
    >
    >
    > while (!rs.EOF) {
    > var f1 = rs.Fields("Field1").value;
    > var f2 = rs.Fields("Field2").value;
    > var f3 = rs.Fields("Field3").value;
    > }
    You have an infinite loop. You left out the rs.moveNext(); statement in your
    loop.

    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

  6. #5

    Default Re: code timing out on select from access

    Thanks Bob!



    *** Sent via Devdex [url]http://www.devdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Jeremy Zifchock 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