I have re-written my code after great help from some friendly stack overflow members (big thanks to Martin B and Kev Chadders especially). I would now like to check if my code is still open to SQL Injections after this work. I believe the code is now working as it should, but any blinding errors that you see i’d love to hear about too. My code is now looking like:
-code removed-
It seems you are safe from SQL injection attacks, but code like this:
and:
could leave you open for other forms of attack such as XSS. You should set the text element of an ASP.NET control, not directly write to the page.