Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Our Top 10 Tips for Classic ASP : Page 7

Tidy up your server-side programming techniques with these 10 great tricks for classic ASP.




Application Security Testing: An Integral Part of DevOps

Stringing Dates Along to the Database

If passing strings that contain quotes causes problems, then passing dates to databases is even more confusing to our readers. This tip explains how to do it properly, depending on the kind of database you are using.

How can I pass a date to a database using ASP?

The answer depends on what database you are using. Say you are using a variable called 'strDate' to hold your date value. If you are using Access, build a string:

strSQL = " valid sql string " & "#" & strDate & "#"

If you are using SQL Server, Sybase, or Oracle, build a string:

strSQL = " valid sql string " & "'" & strDate & "'"

Note the difference is in the delimiters used for sending the date variable. Access uses the pound sign (#), the others use the singe quote (').

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date