Trailing commas when entering data into SQL using ASP

T

Techhead

When I perform the following ASP script to insert form data into SQL,
it appends a trailing "," after the vaule:

sSqlString1 = ("INSERT INTO TABLE(COLUMNA,COLUMNB,COLUMNC,COLUMND)
VALUES ('" & Avalue & "', '" & Bvalue & "', '" & Cvalue & "', '" &
Dvalue & "')")
conn.Execute sSqlString1


When I want to display the data:


Response.Write("A Value: " & AValue & "<br />")
Response.Write("B Value: " & BValue & "<br />")
Response.Write("C Value: " & CValue & "<br />")
Response.Write("D Value: " & DValue & "<br />")


It shows up like this:


A Value: Some data,
B Value: Some data,
C Value: Some data,
D Value: Some data,


It also adds the trailing comma into the SQL table as well. The comma
is not a value in my form and it is not a default value for any form
field.


Any ideas?
 
E

Evertjan.

Techhead wrote on 09 feb 2009 in microsoft.public.inetserver.asp.general:
When I perform the following ASP script to insert form data into SQL,
it appends a trailing "," after the vaule:

sSqlString1 = ("INSERT INTO TABLE(COLUMNA,COLUMNB,COLUMNC,COLUMND)
VALUES ('" & Avalue & "', '" & Bvalue & "', '" & Cvalue & "', '" &
Dvalue & "')")
conn.Execute sSqlString1


When I want to display the data:


Response.Write("A Value: " & AValue & "<br />")
Response.Write("B Value: " & BValue & "<br />")
Response.Write("C Value: " & CValue & "<br />")
Response.Write("D Value: " & DValue & "<br />")


It shows up like this:


A Value: Some data,
B Value: Some data,
C Value: Some data,
D Value: Some data,


It also adds the trailing comma into the SQL table as well. The comma
is not a value in my form and it is not a default value for any form
field.

When using a real database it should not, but how are we to know what and
if you use a database, or some strange form of comma separated textfile,
and incoorect connection strings.
Response.Write("A Value: " & AValue & "<br />")

This does not even show where you have retrieved the value from, if you
did.
 
T

Techhead

Techhead wrote on 09 feb 2009 in microsoft.public.inetserver.asp.general:












When using a real database it should not, but how are we to know what and
if you use a database, or some strange form of comma separated textfile,
and incoorect connection strings.


This does not even show where you have retrieved the value from, if you
did.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)- Hide quoted text -

- Show quoted text -

SQL 2005 is a real database. I am retrieving my values from a simple
form with simple drop-down lists and text fields.
 
B

Bob Barrows

Techhead said:
When I perform the following ASP script to insert form data into SQL,
it appends a trailing "," after the vaule:
Asked and answered over in .db. Please don't multipost.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top