ChristianLinnell
ChristianLinnell

Reputation: 1398

VBScript SQL sanitization

Wary of Jeff Atwood's "Bathroom Wall of Code" post, I thought it would be useful to have a trustworthy SQL sanitisation function for VBScript, similar to PHP's mysql_real_escape_string() function.

So, how can I properly sanitise data input into a SQL query using VBScript?

Upvotes: 2

Views: 1489

Answers (2)

bugmagnet
bugmagnet

Reputation: 7769

Alternatively, use the Escape function as below

wscript.echo Escape(chrw(1023) & vbtab & vbnewline & " ")

which gives

%u03FF%09%0D%0A%20

. The reverse is UnEscape()

Upvotes: 1

John Saunders
John Saunders

Reputation: 161783

Don't do it. Use parameterized queries instead.

Upvotes: 5

Related Questions