A
Arne
From: "Arne de Booij" <[email protected]>
Subject: Comma delimited array into DB problems
Date: 9. februar 2004 10:39
Hi,
I have an asp page that takes input from a form on the previous page,
puts that into an array and inserts the array into SQL server.
Now here is the problem:
The form on the page where the user can enter information contains a
dynamic amount of text boxes with the same name. So when the user
submits their entry, I get a comma delimited string.
e.g. First entry, Second entry, Third entry
The problem comes when a user enters a comma in the text field
e.g. First entry, with a comma, Second entry, Third Entry.
My code will put "with a comma" into a different row in the DB than
"First entry" because of the comma in the string.
Any ideas on how to solve this?
CODE (somewhat simplified)
Detailsvar = request("details")
details = Replace(Detailsvar, "'", "''") 'array
Dim deArray
deArray = Split(details, ", ")
FOR i = Lbound(deArray) TO Ubound(deArray)
DB.Execute("sp_insert_ratings '" & deArray(i) & "'")
NEXT
Arne
Subject: Comma delimited array into DB problems
Date: 9. februar 2004 10:39
Hi,
I have an asp page that takes input from a form on the previous page,
puts that into an array and inserts the array into SQL server.
Now here is the problem:
The form on the page where the user can enter information contains a
dynamic amount of text boxes with the same name. So when the user
submits their entry, I get a comma delimited string.
e.g. First entry, Second entry, Third entry
The problem comes when a user enters a comma in the text field
e.g. First entry, with a comma, Second entry, Third Entry.
My code will put "with a comma" into a different row in the DB than
"First entry" because of the comma in the string.
Any ideas on how to solve this?
CODE (somewhat simplified)
Detailsvar = request("details")
details = Replace(Detailsvar, "'", "''") 'array
Dim deArray
deArray = Split(details, ", ")
FOR i = Lbound(deArray) TO Ubound(deArray)
DB.Execute("sp_insert_ratings '" & deArray(i) & "'")
NEXT
Arne