PDA

View Full Version : Databases Again...



04-03-2002, 12:25 AM
Hi,

New tack on the database thing. I've got Access to make an ASP page itself...

Here's how the setup works:

There is a table for every type of component, each table has values for the components' names, costs, along with an ID, and their stockist...

There is a table called 'Computers' which brings in the attributes from the components tables... I can select which component I want for each system by using a drop-down box.

I then have a query which takes the values from each field in the 'Computers' table. I have asked Access to make an ASP page out of this query, to see how it did it... The page turns out to be about 90% identical to what I want it to do, so I'll just tamper with it a little, however, one MAJOR problem with it...

Rather than displaying the values in the fields as I see them in the Query box in Access, with names such as '128MB PC-133 SDRAM', and 'AMD Athlon XP 1800+', it displays a number...

I have ascertained that these numbers corrolate (spelling?) to the number down in my list box, and are equivalent to the ID of the component way back in the components tables... What's wrong here? Why does Access display the names in the query box, then when viewed as a web page using SQL revert to using a numerical representation???

Completely lost...

I'll post the code that is printing the number, and hopefully you'll make something of it...

Here it is'

<TD BORDERCOLOR=#c0c0c0 ><FONT SIZE=2 FACE='Arial' COLOR=#000000><%=Server.HTMLEncode(rs.Fields('CPUI D').Value)%><BR></FONT></TD>

19 Lines of that, but changing the 'ID' bit, eg 'MotherboardID' etc...

then:

<%

rs.MoveNext

loop%>

What's with it?

I notice that the SQL call says 'CPUID' Which, in the component table is it's unique identifier, though in the 'Computers' Table it is the field I want, and contains the names of components... Is it perhaps bypassing the 'Computers' Table, and taking 'CPUID' from the wrong table?

Thanks for even taking the time to read all that!!

:)

Erin

04-03-2002, 01:03 AM
Hi Erin,

See you've got it working. Congratulations!

Now. The number problem.

When you run the Lookup to create a field in a table you APPEAR to import the name field but, if you looked closely when you were running the wizard you are ACTUALLY importing the unique identifier. The number.

So what you need is not a simple SELECT statement but a more complex one. You need to include both tables in your query and have a JOIN statement.

Easiest way is go back to Access, make a query showing both tables and look at the SQL.

Filter it if you like to check it, unfilter, copy and paste the SQL.

Heather