0

I am using Visual Studio 2008 and Access 2013 as my database.

When I use special characters in a password field, my VB.Net code produces an SQL query error, especially when I am using a special char at the last chat.

For example, if I use jdjdj' as the password then an error occurs.

Normal passwords work. For example:

  • Admin123
  • 123admin
  • 123
  • admin

Where is the problem and how can I fix it?

Eminem
  • 870
  • 5
  • 20
Hansaj
  • 1
  • 3

1 Answers1

1

You need to pass the password to the query as a parameter rather than concatenate it into the query string. It doesn't just stop issues like this, it's also to stop malicious users deliberately taking advantage of your shortcut, to easily gain access to the database. Check out How do I create a parameterized SQL query? Why Should I?

Community
  • 1
  • 1
James Decker
  • 109
  • 4