Skip to content
Advertisement

Data type mismatch in criteria expression. whats wrong?

how do I put an int variable in sql?

Advertisement

Answer

Please don’t use concatenated values in your SQL command. You are exposing your application to SQL Injection Attacks. Read more here.

Use SqlParameters instead. It is the proper way to do and safer when you are running sql commands against your database from your application.

If a value is int covert it to integer:

Here is a example of how to use parameters.

More about SqlCommand here.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement