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

  1. #1

    Default no records

    Hi,
    I am writing a jsp page to get data from db.

    <%@ Language=VBScript %>
    <!-- #include file="ConnString.asp" -->
    <html>
    <head>
    </head>
    <body>
    <%
    dim rsLook
    dim sSql
    dim arResults
    dim i

    Set objCon = server.createobject("adodb.connection")
    objCon.open strConnString

    sSql = "SELECT * FROM table1" & _
    " (NOLOCK) " & _
    "WHERE sIdentifier01 = '19931573'"
    set rsLook = Server.CreateObject("ADODB.Recordset")
    Response.Write "SQL: " & sSql
    rsLook.Open sSql, objCon, , ,adCmdText

    if Not rsLook.EOF then
    arResults=rsLook.GetRows
    End if
    'the recordset is no longer needed, so:
    rsLook.close:set rsLook = nothing
    'if the connection is no longer needed, kill it now:
    ObjCon.close:set ObjCon=nothing

    If IsArray(arResults) then
    Response.Write "<p>This table currently has <strong>"
    & _
    "<font color=""#FF0000"">"
    Response.Write Ubound(arResults,2) + 1
    Response.Write "</font</strong> records."
    else
    Response.Write " No records were returned"
    end if
    %>
    test
    </body>
    </html>

    I got "No records were returned", but when I run the same
    sql in EM it returns a record. I have no idea how to debug
    it. Please help.
    Jen Guest

  2. Similar Questions and Discussions

    1. Group and Sum records
      Team,Score,Team,Score A,4,B,3 B,5,C,2 C,3,D,1 D,3,A,5 I have those 4 records in a database - I need to have them summarized like this: ...
    2. navigating through records
      Using asp/ado/IE: Let say I have a recordset contianing 1000 records. I don't want to show *all* 1000 records in one long table on a page so how do...
    3. DNS text records ?
      I'm having some trouble finding a way to query a specific dns server for the text record of a given name purely in perl. I'm trying to do this with...
    4. DNS SRV Records?
      Hi, how can I query DNS SRV records with ruby? regards Hadmut -- Hadmut Danisch http://www.danisch.de
    5. Filtering records
      Hi: I need to build an ASP query to search a property size that is between minimum and maximum values (in two text boxes in a form). Here is the...
  3. #2

    Default Re: no records

    Jen wrote:
    > Hi,
    > I am writing a jsp page to get data from db.
    >
    >
    > sSql = "SELECT * FROM table1" & _
    > " (NOLOCK) " & _
    > "WHERE sIdentifier01 = '19931573'"
    > set rsLook = Server.CreateObject("ADODB.Recordset")
    > Response.Write "SQL: " & sSql
    >
    > I got "No records were returned", but when I run the same
    > sql in EM it returns a record. I have no idea how to debug
    > it. Please help.
    Show us the result of
    Response.Write "SQL: " & sSql

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

  4. #3

    Default Re: no records

    thanks
    the sql output is

    SELECT * FROM table1 (NOLOCK) WHERE sIdentifier01
    = '19931573'
    >-----Original Message-----
    >Jen wrote:
    >> Hi,
    >> I am writing a jsp page to get data from db.
    >>
    >>
    >> sSql = "SELECT * FROM table1" & _
    >> " (NOLOCK) " & _
    >> "WHERE sIdentifier01 = '19931573'"
    >> set rsLook = Server.CreateObject("ADODB.Recordset")
    >> Response.Write "SQL: " & sSql
    >>
    >> I got "No records were returned", but when I run the
    same
    >> sql in EM it returns a record. I have no idea how to
    debug
    >> it. Please help.
    >
    >Show us the result of
    >Response.Write "SQL: " & sSql
    >
    >Bob Barrows
    >--
    >Microsoft MVP - ASP/ASP.NET
    >Please reply to the newsgroup. This email account is my
    spam trap so I
    >don't check it very often. If you must reply off-line,
    then remove the
    >"NO SPAM"
    >
    >
    >.
    >
    Jen Guest

  5. #4

    Default Re: no records

    Jen wrote:
    > thanks
    > the sql output is
    >
    > SELECT * FROM table1 (NOLOCK) WHERE sIdentifier01
    > = '19931573'
    And this query returns records when run without modification in Query
    Analyzer? What is the datatype of the sIdentifier01 column?

    Is this table normalized? The "01" makes me nervous.

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

  6. #5

    Default Re: no records

    this is query returns 1 record. sIdentifier01 is the
    primary key and type char.

    thanks
    >-----Original Message-----
    >Jen wrote:
    >> thanks
    >> the sql output is
    >>
    >> SELECT * FROM table1 (NOLOCK) WHERE sIdentifier01
    >> = '19931573'
    >
    >And this query returns records when run without
    modification in Query
    >Analyzer? What is the datatype of the sIdentifier01
    column?
    >
    >Is this table normalized? The "01" makes me nervous.
    >
    >Bob Barrows
    >--
    >Microsoft MVP - ASP/ASP.NET
    >Please reply to the newsgroup. This email account is my
    spam trap so I
    >don't check it very often. If you must reply off-line,
    then remove the
    >"NO SPAM"
    >
    >
    >.
    >
    Jen Guest

  7. #6

    Default Re: no records

    I think you need to run a trace using SQL Profiler to see what statement is
    actually being sent to the database. SQL Profiler can be found in the SQL
    Server program group. Just open it, connect to the server and run the trace
    while executing the asp page. Look in the trace to see the sql statement
    being sent to the database and tell us what it is.

    Bob Barrows
    Jen wrote:
    > this is query returns 1 record. sIdentifier01 is the
    > primary key and type char.
    >
    > thanks
    >
    >> -----Original Message-----
    >> Jen wrote:
    >>> thanks
    >>> the sql output is
    >>>
    >>> SELECT * FROM table1 (NOLOCK) WHERE sIdentifier01
    >>> = '19931573'
    >>
    >> And this query returns records when run without modification in Query
    >> Analyzer? What is the datatype of the sIdentifier01 column?

    --
    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 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