Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 11th, 2004, 04:13 PM
Authorized User
Join Date: Jul 2003
Location: Urbana, IL, USA.
Posts: 41
Thanks: 0
Thanked 1 Time in 1 Post
Default INSERT INTO <--inserting data into db

I think I put this in the wrong place before...got no hits.

I'm trying to get the insert working first with just the mandatory fields. Please tell me what I'm doing wrong.

Dim strInsert
Dim strValues

strInsert = "uiid,company,addr,city,state,zip,phone"
strValues = Request.Form("uiid") & "," & Request.Form("company") & _
 "," & Request.Form("addr") & "," & Request.Form("city") & _
 "," & Request.Form("state") & "," & Request.Form("zip") & _
 "," & Request.Form("phone")
sSQL = "INSERT INTO vendor (" & strInsert & ") VALUES ('" & strValues & "')"
Set rs = connect.Execute(sSQL)

I get the following error:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Number of query values and destination fields are not the same.
/eforms/testOrder/vendor/multi_uid_results.asp, line 38

Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)

POST 166 bytes to /eforms/testOrder/vendor/multi_uid_results.asp

POST Data:
uiid=123123123&fein=&company=A+big+Comp&attn=&addr =here&addr2=&city=Champaign&state=IL&zip=61820&cou ntry=United+States&phone=333-4444&fax=&email=&firstname=&lastname=

Line 38 = Set rs = connect.Execute(sSQL)

Reply With Quote
  #2 (permalink)  
Old March 11th, 2004, 05:12 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Hi there,

I am not sure about your datatypes, but it looks like you're trying to pass strings without quotes. In a database, string types (among others) need to be enclosed in ':

INSERT INTO MyTable(aNumber, aString, aDate) VALUES(10, 'Hello', '10/10/2004')

If you're using Access, you can also use the # for the date, but not for strings.

Does this help?


Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #3 (permalink)  
Old March 11th, 2004, 05:33 PM
Authorized User
Join Date: Jul 2003
Location: Urbana, IL, USA.
Posts: 41
Thanks: 0
Thanked 1 Time in 1 Post

Thank You

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting data into DB roserose PHP Databases 1 April 24th, 2006 07:54 AM
Problem with inserting data into an Access DB donrafeal ASP.NET 2.0 Basics 0 January 6th, 2006 05:34 PM
how to Insert data into external db method Access VBA 5 May 4th, 2005 10:59 AM
Use Objects or just insert data directly to DB? pedrobernardo VB.NET 2002/2003 Basics 3 December 10th, 2003 05:07 PM
Intercept data sent to printer & insert into DB tricia412 VS.NET 2002/2003 0 September 8th, 2003 02:14 PM

All times are GMT -4. The time now is 04:31 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.