...

View Full Version : Textarea issue - please help!



fast1
09-14-2005, 05:39 AM
Hi guys!

I have created a form to add some data into a database via ASP. I have a text area, but when I add words with an ', I get a syntax error. ie, that's, didn't, etc etc

Is there a way from preventing this??

Thanks!
Daniel

fast1
09-14-2005, 05:52 AM
Ok I just read the sticky thread on this

here is my statement

strSQL = "INSERT INTO jobs (Title,status,Salary,JobCategory,Hotjob,Contact,Duties,Qualifications,[Timestamp])VALUES('" & strTitle & "','" & numStatus & "','" & strSalary & "','" & strJobCategory & "','" & strHotjob & "','" & strContact & "','" & strDuties & "','" & strQualifications & "','" & date() & "')"
adoCon.Execute(strSQL)

where do I add the function?

Thanks!

neocool00
09-14-2005, 02:33 PM
Any place that would contain characters in the database.

Function CSQ(byVal str)
If IsNull(str) Then str = ""
CSQ = Replace(str,"'","''")
End Function

strSQL = "INSERT INTO jobs (Title,status,Salary,JobCategory,Hotjob,Contact,Duties,Qualifications,[Timestamp])VALUES('" & CSQ(strTitle) & "','" & CSQ(numStatus) & "','" & CSQ(strSalary) & "','" & CSQ(strJobCategory) & "','" & CSQ(strHotjob) & "','" & CSQ(strContact) & "','" & CSQ(strDuties) & "','" & CSQ(strQualifications) & "','" & date() & "')"
adoCon.Execute(strSQL)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum