At 11:00 AM -0500 3/6/06, Ed Lee wrote:

I'm looking to take some text input from an EditText field and directly stuff it into a MySQL database, using an SQL UPDATE command.

I'm thinking that using a RegEx check would be ideal here, to strip out any apostrophe characters (').

RegEx is overpowered; ReplaceAll will do the job (as will ReplaceAllB, which is even faster). Here is the functions I usually use to convert a string into the form of an SQL constant:

Function SQLify(s As String) As String
  return "'" + ReplaceAllB(s.ConvertEncoding(Encodings.UTF8), "'", "''") + "'"

End Function


Best,
- Joe

--

Joseph J. Strout
[EMAIL PROTECTED]
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to