when we want to pass sth to database like int we use(%d) like below
...string.format("select * from Table where code=%d",100)...
what should i use instead of %d when we want to pass dateTime ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
dont use string.format() for db parameter substitution, you end up in SQL injection. SqlCommand has Parameters property , you can add the parameters into the collection
use parameterized query like this:
more efficient if you use the Using block with your code.
like this