Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent! Insert, not inserting

Status
Not open for further replies.

janise

Technical User
May 25, 2003
161
US
Can someone, please, please tell me why this insert statement is not working.
Page1 dynamically populates a dropdown list box by selecting the record from the database.
Using post method, passes the values through a form variable (sizeNdx) to page2 which processes the insert statement and inserts into the order table.
So far, I am not getting any errors, yet no record is being inserted.
Any help would be greatly apprecicated.
 
shoot, I forgot to paste the parts of the offending codes.

One more thing to note.- the field oshipmethod is an integer, a foreign key to shipmethods table.
If for instance UPS Air is selected from t he dropdown list box, and the number associated with it is 2, that will be the value inserted into the orders table by way of sizeNdx form variable.

Sorry about not posting a code snippet.

Code:
page1.asp
******
<%
 set shipDB = Server.CreateObject("ADODB.Connection")
 shipDB.Open "dsn=ship"
%>
<tr>
<td align=right><span class="bodyText"><b>Shipping options:</b><br>(Please pick one) 
</td>
<td></td>
<td><span class="bodyText">
<select size="1" name="sizeNdx">
<option value="">Pick One</option>
<%
	sql = "SELECT * FROM shippingMethods"
	set shipset = shipDB.Execute(sql)
	while not shipset.eof
%>
       <option value="<%=shipset(0)%>"><%=shipset(1)%></option>
<%
	shipset.movenext
	wend
	shipset.close
	set shipset = nothing
%>
   </select>
 </td>
</tr>


page2.asp
************

	'On error resume next
	sqlAdd = "INSERT INTO orders(ocustomerid,odate,orderamount,ocardtype,ocardno,"
	sqlAdd = sqlAdd & "ocardname,ocardexpires,ocardaddress"
	If Not Request.Form("shipaddress")="" then
		sqlAdd = sqlAdd & ",oshipaddress,oshiptown,oshipzip,oshipstate,oshipcountry,oshipmethod"
	End If
	sqlAdd = sqlAdd & ") VALUES("
	sqlAdd = sqlAdd & Session("customerid") & ",Date()," & intTotal
	sqlAdd = sqlAdd & ",'" & Request.Form("paymentm") & "','Non-card order' "
	sqlAdd = sqlAdd & ",'N/A',date()"
	sqlAdd = sqlAdd & ",'" & TwoSingleQ(Request.Form("cardaddress")) & " '"
	If Not Request.Form("shipaddress")="" then
		sqlAdd = sqlAdd & ",'" & TwoSingleQ(Request.Form("shipaddress")) & "'"
		sqlAdd = sqlAdd & ",'" & TwoSingleQ(Request.Form("shiptown")) & " '"
		sqlAdd = sqlAdd & ",'" & Request.Form("shipzip") & " '"
		sqlAdd = sqlAdd & ",'" & Request.Form("shipstate") & " '"
		sqlAdd = sqlAdd & ",'" & Request.Form("shipcountry") & " '"
		sqlAdd = sqlAdd & "," & Request.Form("sizeNdx") & " "

	End If
	sqlAdd = sqlAdd & ")"
 
ok, I solved it,
I just needed to add a field called oshipmethod to this line:
sqlAdd = sqlAdd & "ocardname,ocardexpires,ocardaddress"

and that did it.
Thanks for the response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top