473,385 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 2077
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Chris Geerdink | last post by:
combo with PHP. what is wrong with the Javascript? else { include("mysql.php"); $query1 = mysql_query("INSERT INTO gbook (naam, email, text) VALUES ('".$_POST."', '".$_POST."',...
2
by: Tony | last post by:
I found similar code for encoding/decoding strings in VB which works fine. However I wanted to use it in a C# projected and can't get it to work. When it executes the TransformFinalBlock() call at...
1
by: aa | last post by:
When I am reading from local disk (d:), everithing is OK, but then I am reading from map disk I am geting the this error. Whats wrong. Thanks Server Error in '/Extra' Application....
3
by: mahsa | last post by:
Hi do you know whats wrong with this code? <asp:HyperLink id="HLink_Help" runat="server" NavigateUrl='<%# "javascript:window.open('comments.aspx?id=1,width=500,height=600, scrollBars=yes');"...
3
by: Vaidas Gudas | last post by:
I has web project on virtual pc, maked with framework 2.0. there I was used the method role.roleexists("admin") and everything was worked good. but when i replace this project on my local machine,...
4
by: blah | last post by:
Hello everyone, Ive been trying to get my application to "click" on a button in another application using SendMessage, Ive gotten this far but Im not sure whats wrong with this code, here is the...
7
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell...
4
by: LoneHunter01 | last post by:
Basically, I just need a general direction on where to go for this. Yes, this is for a school project, though it's strictly an optional one (and I have tried many solutions, one in-depth). We've...
10
by: joestevens232 | last post by:
Ok everything is good...I read in all my grades into each of the different arrays that they need to go in. Now Im trying to write a function that takes the grades and computes the average on a...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.