navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Update SQL datefield

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Update SQL datefield
Page: [1]
 
Topic Starter

 

Posts: 49
From: Canada, eh?
Status: offline

 
Update SQL datefield - 4/4/2002 11:34:46   
Here is my SQL statement:

sQry="UPDATE Webcasts SET Copyright=convert(datetime, '" & Request.Form("Copyright") & "'), Title='" & Request.Form("Title") & "', Expiry=convert(datetime, '" & Request.Form("Expiry") & "') WHERE ID=" & Request.QueryString("ID") & ""

Which outputs this:

UPDATE Webcasts SET Copyright=convert(datetime, '22/02/2002'), Title='Marc Title for testing', Expiry=convert(datetime, '22/02/2003') WHERE ID=91

But I get the error:

Description: [Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
Number: -2147217913 (0x80040E07)
Source: Microsoft OLE DB Provider for ODBC Drivers

I've looked in my database, and I see that the table shows the dates in the format dd/mm/yyyy, which is the way that I'm inputting it.

What is the problem????


Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Update SQL datefield - 4/4/2002 20:33:15   
From BOL:
When transforming a string (DBTYPE_WSTR) into a date (DBTYPE_DATE) or time (DBTYPE_TIME) column from a text file, only one date or time format (yyyy-mm-dd hh:mm:ss.fffffffff) is accepted by the OLE DB data conversion service component. Use the Date Time String transformation, or code a Microsoft ActiveX® script transform using the CDate function to transform dates correctly

SQL expects that format to be supplied

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login

(in reply to Topic Starter)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Update SQL datefield
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts