[thelist] Question about Access database programming with ASP 3.0

Ken Schaefer ken at adOpenStatic.com
Wed Jun 9 18:57:56 CDT 2004


Hi,

The output from an SQL query is always a table (like you see). Some of the
data is repeated in order to "fill" the table.

What you need to do is write some code in your presentation layer to format
this the way you want to.

Something like:

If we have records then

    Create a temporary name storage variable
    While we still have records

        If current record's name <> name in temp storage variable then

            store current name in temporary storage variable
            write current name
            write current phone number

        else

            write current phone number

        end if

        move to next record

    Loop

End if

Cheers
Ken


----- Original Message ----- 
From: "Jonathan" <j at firebright.com>
To: <thelist at lists.evolt.org>
Sent: Thursday, June 10, 2004 9:24 AM
Subject: [thelist] Question about Access database programming with ASP 3.0


: Howdy everyone...
:
: Listen, I have a simple problem I'm trying to solve for a friend of mine,
: but I'm not an ASP programmer.  I've been fighting with this one for
: hours...
:
: I've got this database in Access that looks like this:
: http://www.firebright.com/staged/db.gif
:
: What I'm looking to generate is something that looks about like this:
:
: NAME HOME PHONE
: --------------------------------------------------------------------
: Jim House based on houseID 884-343-3333
: 884-343-3332
: 884-343-3335
:
: James House based on houseID 884-343-3311
: 884-343-3331
:
:
: I'm getting close to what I want, but it's not right...  This is the code
I
: have written...
:
: <%
: Set MyConn = Server.CreateObject("ADODB.Connection")
: MdbFilePath = Server.MapPath("baza.mdb")
: MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath
&
: ";"
: SQL_query = "SELECT DISTINCT Names.NameID, Names.HouseID, Names.Name,
: Phones.PhoneID, Phones.Phone From Names, Phones WHERE Names.NameID =
: Phones.NameID"
: Set RS = MyConn.Execute(SQL_query)
: %>
:
: But it's outputting something more like:
:
: Name House  Phone
: Jim 3 215-243-1240
: Jim 3 267-210-7237
: Jim 3 206-333-0575
: James 1 916-339-3163
: James 1 916-265-0320
: James 1 916-639-0325
: James 1 916-339-0161
:
: Now that's not right...



More information about the thelist mailing list