471,881 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,881 software developers and data experts.

whats wrong with this SQL string

Hi all,
I ahve the following SQL string but when i try to response.Write it there is
a error where the ',' should be between "city" and "County"

SQL = "INSERT * INTO customers (Company_Name, Category, Contact_Name,
Contact_Title, Address_1, Address_2, City, County, Post_Code, Phone_1,
Phone_2, Fax, Web_URL, email_Address, Delivery, Notes)"
SQL = SQL & " VALUES('" & Request.Form("Company_Name") & "','" &
Request.Form("Category") & "','" * Request.Form("Contact_Name") & "','" &
Request.Form("Contact_Title") & "','" * Request.Form("Address_1") & "','" &
Request.Form("Address_2") & "','" & Request.Form("City") & "','" &
Request.Form("County") & "','" & Request.Form("Post_Code") & "','" &
Request.Form("Phone_2") & "','" & Request.Form("Fax") & "','" &
Request.Form("Web_Url") & "','" & Request.Form("email_address") & "','" &
Request.Form("Delivery") & "','" & Request.Form("Notes") & "')"

OUTPUT

INSERT * INTO customers (Company_Name, Category, Contact_Name,
Contact_Title, Address_1, Address_2, City, County, Post_Code, Phone_1,
Phone_2, Fax, Web_URL, email_Address, Delivery, Notes)
VALUES('','1','','','','address_2','1, 1','','','','','','','','')

The text in questiuon is '1,1' When it should be '1','1' The SQL code should
output that syntax but it isnt? Any ideas why?


Jul 19 '05 #1
5 1998
Do a Response.Write on JUST the two vaules in question once.
--
----------------------------------------------------------
Curt Christianson (Software_AT_Darkfalz.Com)
Owner/Lead Designer, DF-Software
http://www.Darkfalz.com
---------------------------------------------------------
...Offering free scripts & code snippits for everyone...
---------------------------------------------------------
"Mike M" <mi**@mack1.karoo.co.uk> wrote in message
news:bh**********@newsreaderm1.core.theplanet.net. ..
Hi all,
I ahve the following SQL string but when i try to response.Write it there is a error where the ',' should be between "city" and "County"

SQL = "INSERT * INTO customers (Company_Name, Category, Contact_Name,
Contact_Title, Address_1, Address_2, City, County, Post_Code, Phone_1,
Phone_2, Fax, Web_URL, email_Address, Delivery, Notes)"
SQL = SQL & " VALUES('" & Request.Form("Company_Name") & "','" &
Request.Form("Category") & "','" * Request.Form("Contact_Name") & "','" &
Request.Form("Contact_Title") & "','" * Request.Form("Address_1") & "','" & Request.Form("Address_2") & "','" & Request.Form("City") & "','" &
Request.Form("County") & "','" & Request.Form("Post_Code") & "','" &
Request.Form("Phone_2") & "','" & Request.Form("Fax") & "','" &
Request.Form("Web_Url") & "','" & Request.Form("email_address") & "','" &
Request.Form("Delivery") & "','" & Request.Form("Notes") & "')"

OUTPUT

INSERT * INTO customers (Company_Name, Category, Contact_Name,
Contact_Title, Address_1, Address_2, City, County, Post_Code, Phone_1,
Phone_2, Fax, Web_URL, email_Address, Delivery, Notes)
VALUES('','1','','','','address_2','1, 1','','','','','','','','')

The text in questiuon is '1,1' When it should be '1','1' The SQL code should output that syntax but it isnt? Any ideas why?

Jul 19 '05 #2
You probably have 2 city form fields causing the 1,1 indexed value.

Cheers!

Shawn Jackson
Freelance Web Developer
http://www.actionjackson.com
http://www.developersdex.com
http://www.automationtools.com
sh***@actionjackson.com
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
grw
Whats the " * Request.Form" all about?

I think youll find its because of that typo.
The & is next door ;-)
"Mike M" <mi**@mack1.karoo.co.uk> wrote in message
news:bh**********@newsreaderm1.core.theplanet.net. ..
Hi all,
I ahve the following SQL string but when i try to response.Write it there is a error where the ',' should be between "city" and "County"

SQL = "INSERT * INTO customers (Company_Name, Category, Contact_Name,
Contact_Title, Address_1, Address_2, City, County, Post_Code, Phone_1,
Phone_2, Fax, Web_URL, email_Address, Delivery, Notes)"
SQL = SQL & " VALUES('" & Request.Form("Company_Name") & "','" &
Request.Form("Category") & "','" * Request.Form("Contact_Name") & "','" &
Request.Form("Contact_Title") & "','" * Request.Form("Address_1") & "','" & Request.Form("Address_2") & "','" & Request.Form("City") & "','" &
Request.Form("County") & "','" & Request.Form("Post_Code") & "','" &
Request.Form("Phone_2") & "','" & Request.Form("Fax") & "','" &
Request.Form("Web_Url") & "','" & Request.Form("email_address") & "','" &
Request.Form("Delivery") & "','" & Request.Form("Notes") & "')"

OUTPUT

INSERT * INTO customers (Company_Name, Category, Contact_Name,
Contact_Title, Address_1, Address_2, City, County, Post_Code, Phone_1,
Phone_2, Fax, Web_URL, email_Address, Delivery, Notes)
VALUES('','1','','','','address_2','1, 1','','','','','','','','')

The text in questiuon is '1,1' When it should be '1','1' The SQL code should output that syntax but it isnt? Any ideas why?

Jul 19 '05 #4

"Mike M" <mi**@mack1.karoo.co.uk> wrote in message
news:bh**********@newsreaderm1.core.theplanet.net. ..
Hi all,
I ahve the following SQL string but when i try to response.Write it there is a error where the ',' should be between "city" and "County"

SQL = "INSERT * INTO customers (Company_Name, Category, Contact_Name,
Contact_Title, Address_1, Address_2, City, County, Post_Code, Phone_1,
Phone_2, Fax, Web_URL, email_Address, Delivery, Notes)"
SQL = SQL & " VALUES('" & Request.Form("Company_Name") & "','" &
Request.Form("Category") & "','" * Request.Form("Contact_Name") & "','" &
Request.Form("Contact_Title") & "','" * Request.Form("Address_1") & "','" & Request.Form("Address_2") & "','" & Request.Form("City") & "','" &
Request.Form("County") & "','" & Request.Form("Post_Code") & "','" &
Request.Form("Phone_2") & "','" & Request.Form("Fax") & "','" &
Request.Form("Web_Url") & "','" & Request.Form("email_address") & "','" &
Request.Form("Delivery") & "','" & Request.Form("Notes") & "')"

OUTPUT

INSERT * INTO customers (Company_Name, Category, Contact_Name,
Contact_Title, Address_1, Address_2, City, County, Post_Code, Phone_1,
Phone_2, Fax, Web_URL, email_Address, Delivery, Notes)
VALUES('','1','','','','address_2','1, 1','','','','','','','','')

The text in questiuon is '1,1' When it should be '1','1' The SQL code should output that syntax but it isnt? Any ideas why?

thanks all, got it sorted

Jul 19 '05 #5
THE CORRECT SYNTAX IS
INSERT INTO [TABLE] (STRINGFIELD,INTEGERFIELD,BOOLEANFIELD) VALUES ('MY
STRING',1,TRUE);

AS YOU CAN SEE THERE IS ONE VALID VALUE FOR EVERY FIELD:
STRINGFIELD='MY STRING'
INTEGERFIELD=1
BOOLEANFIELD=TRUE

TRY MACH YOUR VALUES OK?
AND BECAREFUL WITH * AND & WHEN YOU TRY TO JOIN YOUR QRY
Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Chris Geerdink | last post: by
1 post views Thread by aa | last post: by
3 posts views Thread by mahsa | last post: by
3 posts views Thread by Vaidas Gudas | last post: by
4 posts views Thread by blah | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.