Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 11th, 2004, 04:13 PM
Authorized User
 
Join Date: Jul 2003
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)

Page:
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)



 
Old March 11th, 2004, 05:12 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 11th, 2004, 05:33 PM
Authorized User
 
Join Date: Jul 2003
Posts: 41
Thanks: 0
Thanked 1 Time in 1 Post
Default

Imar,
Thank You






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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.