drop down population help needed - thanks

K

Kingdom

What's on line 138?

Is it an update or an insert? If so, then you are missing a required
parameter.

If you do an update(or an insert) you have to either a) provide a
value for all fields or b) specify the fields you are providing a
value for

a) INSERT INTO Parts_Table Values ('MyPartType', 'MyPartName')
b) INSERT INTO Parts_Table(Part_Type, Part_Name)
VALUES('MyPartType','MyPartName')

It's just the very last line of the script %>

I haven't made any other changes other than the connection
sConnectionString
 
T

Tom B

Does your table look like mine?


Kingdom said:
It's just the very last line of the script %>

I haven't made any other changes other than the connection
sConnectionString
 
K

Kingdom

Something's odd. The code should only be 80 lines long?

inserted into Frontpage page meta tags etc.

===========================================

<%@ Language=VBScript %>
<% Option Explicit %>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-
1252">
<meta http-equiv="Content-Language" content="en-us">
<title>Selectbox</title>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">

<style fprolloverstyle>A:hover {color: red; font-weight: bold}
</style>

<meta name="Microsoft Theme" content="tp-or12 1110">
<meta name="Microsoft Border" content="tlb, default">
</head>

<BODY>

<%
Dim sConnectionString
sConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" &
Server.MapPath("\fpdb\kelvindb.mdb")
%>
<%

'FOR DEBUGGING
Dim field
for each field in Request.Form
Response.Write "<li>" & field & ": " & Request.Form
(field) & "</li>"
next
'END DEBUGGING
%>
<form method=Post action=SelectBoxes.asp>
<% call GetSelectBoxes%>
<br>
<input type=submit value=Go>
</form>

</BODY>
</HTML>
<%

Sub GetSelectBoxes()

Dim oCN
Dim oRS
Dim sSQL

sSQL="SELECT UniqueID, Component_Type, Price, Component_Name
FROM Parts_Table ORDER BY Component_Type, Component_Name,"
Set oCN=CreateObject("ADODB.Connection")
oCN.Open sConnectionString
Set oRS=oCN.Execute(sSQL)
if not oRS.EOF then
Dim sCurrentBox
Dim bIsFirst
bIsFirst=true

Do While not oRS.EOF
'OK, we have our recordset.
'Let's go through each "thingy" and create a box for
it.
if sCurrentBox <> oRS.Fields("Component_Type") then

'it's time for a new select box.
'but first, let's close the last box.
if bIsFirst=false then
'make sure it's not the first select box.
Response.Write "</select><br>" & vbCrLf
else
bIsFirst=false
end if

'OK, create the new box.
sCurrentBox=oRS.Fields("Component_Type")
Response.Write sCurrentBox & ": <select
name=""" & sCurrentBox & """>" & vbCrLf
end if
'Now add the individual item
Response.Write vbTab & "<option value=""" &
oRS.Fields("UniqueID") & """>" & _
trim(oRS.Fields
("Component_Name")) & _
"</option>" & vbCrLf


oRS.MoveNext
Loop

'Let's close that last one
Response.Write "</select>" & vbCrLf

end if
Set oRS=nothing
oCN.Close
Set oCN=nothing
End Sub

%>
 
T

Tom B

I assume that the newsreader wrapped your connection string and the sql
statement?
Also, the line....
trim(oRS.Fields("Component_Name"))

Oh, I see it....There's a comma at the end of your sql statement - it
shouldn't be there.
 
K

Kingdom

Yipppeeeeeeee!!!

It's alive.

Thankyou Tom this really is apreciated, now its up and running I'll gently
and slowly add to it and learn a lot more in the process (hopefully)

I'm sure you must have got fed up with my postings, thanks again.
If there is any graphics/art work you ever need just drop me a line, I'm
much better at graphics than code and I owe you one.

Oh thanks to Bob too!

I get a feeling I'll be back soon but hopefully not with another marathon.

And just before I go, the main error I had was an underscore in my UniqueID
field, can't believe I'm so blind as not to have spotted this much ealier.

Cheers
 
K

Kingdom

New it wouldn't be too long before I was back.

ID : Product_Type

At the moment it writes out the UniqueID and field type.

I'd like to add the box selection and the price but not having much sucess.

So I get

ID : Product_Type : Product_Name : Price

but using the code below I still only get the first two

=====================

Dim field
Dim Price
Dim Component_Name
for each field in Request.Form
Response.Write "<li>" & Request.Form(field) & ": " &_
field & Component_Name & Price &"</li>"
next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top