Searching database problem

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

  1. #1

    Default Searching database problem



    Having an issue. Trying to create an ASP search page that queries SQL
    2k database based on some set and some variable criteria. The problem,
    I think, lies in how I am presenting the SQL statement to the SQL
    server. Thanks in advance.

    Code follows:
    =============

    noodle="SELECT Customers.[Company Name], Customers.State,
    Schedule.PurchaseType, Schedule.[Equipment Amount] " & _
    "FROM Customers INNER JOIN Schedule ON Customers.ID = Schedule.ID " & _
    "WHERE (Schedule.PurchaseType) = '" & rEquipmentType & "' "

    set WhataRecordset = cn.execute (noodle)
    do While Not WhataRecordset.EOF
    Response.Write("<tr><td>" & [Customers].[Company Name] & "</td><td>" &
    [Customers].[State] & "</td><td>" & _
    [Schedule].[PurchaseType] & "</td><td>" & [Schedule].[Equipment Amount]
    & "</td></tr>")

    WhataRecordset.MoveNext
    loop
    WhataRecordset.close

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    HallMonitor89 Guest

  2. Similar Questions and Discussions

    1. Problem with searching PDF file
      Hi guys, Now I face one problem. I use cfidex to search the text in the PDF file. I only can find the PDF file converted from word document . ...
    2. searching for record before adding to database
      Hi all, Im creating a form, and I can now add and save the record. However, since we are concern on duplicate records, I use email as the field...
    3. Searching A Database Using Greater & Lesser Than
      I have a database with a field called "Value" in one of my tables. This field is just set as number. I want to be able to search this field so that...
    4. Searching MS Database
      Hello. I'm trying to develope ASP Javascript pages that search an MS Access Database. The first page of the application offers 4 ways to search,...
    5. Searching a database .... query optimization (how do I read the explain on output?)
      I've got a more-or-less open search of the database in question, which works just fine, if you don't mind the upwards of 20+ seconds it takes to...
  3. #2

    Default Re: Searching database problem

    It usually helps to say what error you're getting.
    <%
    do While Not WhataRecordset.EOF
    Response.Write("<tr><td>" & WhataRecordset.Fields.Item(0).Value &
    "</td><td>" & WhataRecordset.Fields.Item(1).Value & "</td><td>" & _
    WhataRecordset.Fields.Item(2).Value & "</td><td>" &
    WhataRecordset.Fields.Item(4).Value & "</td></tr>")
    %>

    You don't use the column names in your ASP code like that. You reference
    the columns within the recordset object, either by name, or by numeric
    index, starting at 0. In this recordset, index 0 is Company Name, 1 is
    State, and so on.

    Also, since you're in the beginning of things, assumingly, you should rename
    your columns in your database and ditch the spaces...

    Ray at work




    "HallMonitor89" <nospam@novirus.com> wrote in message
    news:ea9HX9CxDHA.2520@TK2MSFTNGP10.phx.gbl...
    >
    >
    > Having an issue. Trying to create an ASP search page that queries SQL
    > 2k database based on some set and some variable criteria. The problem,
    > I think, lies in how I am presenting the SQL statement to the SQL
    > server. Thanks in advance.
    >
    > Code follows:
    > =============
    >
    > noodle="SELECT Customers.[Company Name], Customers.State,
    > Schedule.PurchaseType, Schedule.[Equipment Amount] " & _
    > "FROM Customers INNER JOIN Schedule ON Customers.ID = Schedule.ID " & _
    > "WHERE (Schedule.PurchaseType) = '" & rEquipmentType & "' "
    >
    > set WhataRecordset = cn.execute (noodle)
    > do While Not WhataRecordset.EOF
    > Response.Write("<tr><td>" & [Customers].[Company Name] & "</td><td>" &
    > [Customers].[State] & "</td><td>" & _
    > [Schedule].[PurchaseType] & "</td><td>" & [Schedule].[Equipment Amount]
    > & "</td></tr>")
    >
    > WhataRecordset.MoveNext
    > loop
    > WhataRecordset.close
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

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