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
Your CleanForSQL method only handles string situations. What happens when you're not using a string but an INT instead? In that case, there would be no end tick to close with, so the injection would still happen. Consider this example...
Database.DBUpdate("UPDATE tblFilledForms SET Int1 = " + CleanForSQL(txtNote.Text) + " WHERE FilledFormID = " + DGVNotes.SelectedRows(0).Cells("FilledFormID").Value.ToString)
in that case, just entering the following will work...
0; update tblMaint SET Value1 = 2 WHERE ValueID = 2--