...

View Full Version : ASP Overflow Error Help!!!



chrismartin
06-08-2005, 03:06 PM
Hi there, can someone please help me with this, I keep getting an overflow error and don't know what it means. It is in line 90 which I have highlighted. Any help would be appreciated

<%
FUNCTION fixQuotes( theString )
fixQuotes = REPLACE( theString, "'", "''" )
END FUNCTION
DIM cost
cust_name = TRIM( Request.Form( "cust_name" ) )
address1 = TRIM( Request.Form( "address1" ) )
address2 = TRIM( Request.Form( "address2" ) )
address3 = TRIM( Request.Form( "address3" ) )
postcode = TRIM( Request.Form( "postcode" ) )
email = TRIM( Request.Form( "email" ) )
c_card = TRIM( Request.Form( "c_card" ) )
expiry = TRIM( Request.Form( "expiry" ) )
productid = TRIM( Request.Form( "ProductID" ) )
Dim con, location
Set con = Server.CreateObject("ADODB.Connection")
location = Server.MapPath("db/db.mdb")
con.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & location
sqlString = "INSERT into OrderForms (CustomerName, CustomerAddress1, CustomerAddress2, CustomerAddress3, CustomerPostcode, email, c_card, expiry, ProductID) values ('" &cust_name& "', '" &address1& "','" &address2& "', '" &address3& "', '"&postcode&"', '"&email&"', '"&c_card&"', '"&expiry&"', '" & productid & "')"
Con.Execute sqlString
%>
<%
con.close
%>
<% response.write "The form information was inserted successfully." %>

Thanks

miranda
06-08-2005, 06:09 PM
Pointing to that line says there is an error in your insert statement. Are you trying to add a record where the primary key field already has a record with that value? That will generate this error. What is the structure of the database table? Can you tell us what the datatype is for each column as well as which field(s) are primary key?

chrismartin
06-08-2005, 08:14 PM
The table looks like this

CustomerName - Text
CustomerAddress1 - Text
CustomerAddress2 - Text
CustomerAddress3 - Text
CustomerPostcode - Text
email - text
c_card - number
expiry - text
OrderNumber - autonumber (Primary Key)
OrderDate - Date/Time (default value = todays date)
Status - text (default value = pre design)
ProductID - number

thanks

miranda
06-08-2005, 08:30 PM
are any of the fields indexed Yes (No Duplicates)?
Try adding Response.Write(sqlString) 1 line below the sql string and before Con.Execute sqlString

This will show you if there are any errors in the SQL statement and also show the values of the variables.

Another thing to look for is spaces or dashes in the credit card. Because this is a number field either will cause your error. You would be better off to use a TEXT field there and for security sake you really should Encrypt the credit card number in case the system is hacked.

chrismartin
06-08-2005, 11:17 PM
thanks miranda, got everything workin now!

miranda
06-08-2005, 11:50 PM
You are welcome



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum