I\'m trying to simply prove here that this simple function isn\'t good enough to prevent every sql injection in the world:
Function CleanForSQL(ByVal input A
The Chr(8) is part of the quoted literal string, as is the update statement, so SQL Server is not going to interpret it as a function call. With this example, Text1 will be set to the literal value:
'Chr(8); update tblMaint SET Value1 = 2 WHERE ValueID = 2--
(yes, including that single quote)
So, with this example, your code is secure. Most hang-wringing over SQL injection is about accidentally failing to validate and quote values, there is nothing inherently unsafe in a properly-quoted SQL statement.