Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 4th, 2004, 08:25 AM
Authorized User
 
Join Date: Jul 2004
Location: , , Ireland.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trying to update a date field

Hi,

I'm trying to use the UPDATE statement to update a date field in an Access database, but no matter what I do it doesn't work. :(

Here's the code :

Set objRS2 = Server.CreateObject("ADODB.Recordset")

strSQL2 = "UPDATE tblSubject SET Date = #4-Nov-2004# WHERE Subject = '" & strSubject & "'"

objRS2.Open strSQL2, strConnect

I just keep getting an error 'Syntax error in UPDATE Statement'. I've done searches online for how to update date fields, and have tried everything I've found, but no luck.

I can successfully update the Subject field, btw - it's just when I try to update the date that I run into problems.

Please help save what's left of my tattered sanity!!

Rgds,
Jennie.
Reply With Quote
  #2 (permalink)  
Old November 4th, 2004, 08:40 AM
Authorized User
 
Join Date: Jul 2004
Location: , , Ireland.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, it eventually came to me in a flash of divine inspiration.

The field name 'Date' was causing the problem.

I currently owe the swear-box a fortune.

Reply With Quote
  #3 (permalink)  
Old November 4th, 2004, 08:42 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hey Jennie,

If you don't want to change the field name, you can just use [Date] in your query rather than Date.

HTH,

Chris
Reply With Quote
  #4 (permalink)  
Old November 4th, 2004, 08:55 AM
Authorized User
 
Join Date: Jul 2004
Location: , , Ireland.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Chris!

That's handy, now I don't have to change code elsewhere that selects that field.

Jennie.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating an auto update date field tmswenson MySQL 3 January 4th, 2006 03:12 PM
Update Date Field desireemm Access 1 October 16th, 2005 12:25 AM
Update city field based on zip field nganb SQL Server ASP 0 April 22nd, 2004 10:30 PM
Update a date field levinll SQL Language 1 January 16th, 2004 02:41 PM
SQL2000 Date/Time field update Lucian Ion Dreamweaver (all versions) 9 January 2nd, 2004 09:14 PM



All times are GMT -4. The time now is 08:33 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.