Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Database insertion error - Please help!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Database insertion error - Please help!

 Post Reply Post Reply
Author
camds View Drop Down
Newbie
Newbie


Joined: 25 May 2004
Location: United States
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote camds Quote  Post ReplyReply Direct Link To This Post Topic: Database insertion error - Please help!
    Posted: 25 May 2004 at 4:30pm

I am trying to insert a new record into a database containing data captured from a form. I am repeatedly getting an error, and can't seem to resolve it. Please help! Thanks for your time...

Microsoft OLE DB Provider for ODBC Drivers error '80040e57' [Microsoft][ODBC Microsoft Access Driver]Numeric value out of range (null) /xsignupform.asp, line 653


Here is the code I am using for the database insertion:

Dim oConn, sSQL
Dim connectstr, sDSNDir
Dim dsn_name, fieldname, tablename
Dim firstname, lastname, company, telephone, email, currentprovider, callspeople, callslength, cardtype, cardnumber, cardexpiration, cardsecnumber, cardfullname, cardzip, address1, address2, city, sstate, zip, recommend

firstname = Request.Form("firstname")
lastname = Request.Form("lastname")
company = Request.Form("company")
telephone = Request.Form("telephone")
email = Request.Form("email")
currentprovider = Request.Form("conference")
callspeople = Request.Form("callspeople")
callslength = Request.Form("callslength")
cardtype = Request.Form("cardtype")
cardnumber = Request.Form("cardnumber")
cardexpiration = Request.Form("cardexpiration")
cardsecnumber = Request.Form("security")
cardfullname = Request.Form("cardfullname")
cardzip = Request.Form("cardzip")
address1 = Request.Form("address1")
address2 = Request.Form("address2")
city = Request.Form("city")
sstate = Request.Form("state")
zip = Request.Form("zipcode")
recommend = Request.Form("recommend")

sSQL = "INSERT into UserData (firstname, lastname, company, telephone, email, currentprovider, callspeople, callslength, cardtype, cardnumber, cardexpiration, cardsecnumber, cardfullname, cardzip, address1, address2, city, sstate, zip, recommend) values ('" & _
 firstname & "', '" & lastname & "', '" & company & "', '" & telephone & "', '" & email & "', '" & currentprovider & "', '" & callspeople & "', '" & callslength & "', '" & cardtype & "', '" & cardnumber & "', '" & cardexpiration & "', '" & cardsecnumber & "', '" & cardfullname & "', '" & cardzip & "', '" & address1 & "', '" & address2 & "', '" & city & "', '" & sstate & "', '" & zip & "', '" & recommend & "')" 
 
dsn_name = "access_data.dsn"
fieldname = "firstname"
tablename = "UserData"

sDSNDir = Server.MapPath("_dsn")
connectstr = "filedsn=" & sDSNDir & "\" & dsn_name

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr 
 
oConn.execute(sSQL)
 
oConn.Close
Set oConn = Nothing

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2004 at 4:13am

Numeric value out of range (null)

check all your integer values and see if they fit into the db field

Back to Top
psycotik View Drop Down
Groupie
Groupie


Joined: 27 November 2003
Status: Offline
Points: 73
Post Options Post Options   Thanks (0) Thanks(0)   Quote psycotik Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2004 at 6:49am

change this line:

oConn.execute(sSQL)

to:

Response.Write sSQL

oConn.execute(sSQL)

You will alteast then be able to see by looking through the code where the error is.

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2004 at 11:13am

Is this MSSQL or Access? If it's MSSQL I would use a stored procedure instead so you don't waste time worrying about SQL Injections (Which are possible with the code you posted - I would review it) and it looks much tidier

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2004 at 1:20pm
ODBC Microsoft Access Driver

It's probably Access
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2004 at 1:32pm
In that case do a google for "SQL Injections" and look how you can prevent them and what they could do
Back to Top
camds View Drop Down
Newbie
Newbie


Joined: 25 May 2004
Location: United States
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote camds Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2004 at 4:02pm
Great, thanks guys. I will research. If you have any other ideas, please let me know...
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.