| | |
Problem with input
Please support our ASP advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Mar 2006
Posts: 1
Reputation:
Solved Threads: 0
Hello all!
I need to fill a database using microsoft access and sql in an asp page.
I need to check that the input is not exsit yet, so I use the following to create sql sentence:
tempsql = select * from table where filed= '"
tempsql = tempsql & request.form("name")
tempsql = tempsql & "'"
My problem is that I have to allow the input to include the sign ' ... it doesnt agree to acept it because of the field =' '...
In which other form can I get that input?
Thanks,
Plonter
I need to fill a database using microsoft access and sql in an asp page.
I need to check that the input is not exsit yet, so I use the following to create sql sentence:
tempsql = select * from table where filed= '"
tempsql = tempsql & request.form("name")
tempsql = tempsql & "'"
My problem is that I have to allow the input to include the sign ' ... it doesnt agree to acept it because of the field =' '...
In which other form can I get that input?
Thanks,
Plonter
You will need to use a simple, yet essential, replace statement on your inputs to allow the use of quotes. This allows the users to input values such as O'Hare legitimately, and also prevents the simplest form of SQL Injection attack by the use of a ' to break the code. A simple function to replace quotes would be like:
ASP Syntax (Toggle Plain Text)
function cleanString( string ) '// replace single quotes strTemp = replace(string, "'", "''") '// replace quotes strTemp = replace(strTemp, """", """""") cleanString = strTemp end function
If I've been a help please confirm by clicking the Add to Lafinboy's Reputation link in the header of this reply.
Lafinboy Productions
:: Website Design :: Website Development ::
Lafinboy Productions
:: Website Design :: Website Development ::
![]() |
Similar Threads
- How to do Input in Python? (Python)
- reversing number problem. (C)
- Checkbox Input Problem (ASP)
- Problem with user input (C++)
- stack palindrome problem? (C++)
- Is there a simplest way to work this array problem? (C++)
- Floppy Drive Problem... (Storage)
Other Threads in the ASP Forum
- Previous Thread: Merge two string
- Next Thread: How can i remove the comma?
| Thread Tools | Search this Thread |
archive asp aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection connection database databaseconnection dreamweaver excel fso msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile record searchbox selectoption single specfic sqlserver sqlserverconnection





