[Gambas-user] MySQL query problems with apostropies

Keith Clark keithclark at ...2185...
Tue Apr 6 20:45:59 CEST 2010


I have the following code:

$Query = ""
QueryArray[0] = "insert into products_description"
QueryArray[1] =
"(products_id,language_id,products_name,products_description,products_format)"
QueryArray[2] = "values (" & NewProductID & ",1,'" & TitleTextBox.Text &
"','" & DescriptionTextArea.Text & "'," & FormatID & ")"
LengthOfQuery = 2
FOR QueryIndex = 0 TO LengthOfQuery
        $Query = $Query & QueryArray[QueryIndex]
NEXT 
$Result = DatabaseConnection.$Con.Exec($Query)

Now, it works fine until I try to have a value in
DescriptionTextArea.Text with punctuation like apostrophes and quotation
marks in them.  I get an error in mysql query, always near the
punctuation.

I imagine the same would happen with my value in TitleTextBox as well if
it contained the same punctuation marks.

Any ideas that I'm probably just overlooking?

Keith






More information about the User mailing list