Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Date from ASP to VB to SQL

Status
Not open for further replies.

WakePro

Programmer
Oct 27, 2002
23
CA
what i am trying to do is pass a date entered on an asp page into vb where that variables datatype is date, I then need to pass it into SQL where the datatype is datetime. when ever i execute using the debugger in vb, i have to put the Date into quotes. When i pass those values to SQL it gives me an error that says trouble converting varchar to datetime. Is there anyway to fix this problem.

If you can help thats would be great.
 
Hi,

You'd better try to put '#' into your sql-code :

dim cSql as string
dim cDate as string

cDate = "10/10/2002"
cSql = "UPDATE table set theDate = '#" & cDate & "#'"
 
Note that if you're not working in mm/dd/yyyy format (i.e. if you don't work in North America), you'll need to put your date string into it before it will work.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top