Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Update problem
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

underloop
Starting Member

4 Posts

Posted - 18 September 2003 :  07:12:39  Show Profile
Hi,

I am having a problem adding a new record to an access database on my website, using ASP. Here is the code:

<%@ Language=VBScript %>
<% Option Explicit %>
<!--#include file="../includes/DatabaseConnect.asp"-->
<!--#include file="../includes/adovbs.inc"-->
<%
'Opens the Mix Recordset
Dim rsMixes
Set rsMixes = Server.CreateObject ("ADODB.Recordset")
rsMixes.Open "tblMixes", dbIntense, , adLockOptimistic, adCmdTable

With rsMixes
	

		.AddNew
		.Fields("DJ_ID")=Request.Form("frmDJID")
		.Fields("Genre")=Request.Form("frmGenre")
		.Fields("Length")=Request.Form("frmLength")
		.Fields("Type")=Request.Form("frmType")
		.Fields("Date")=Now
		.Update
End With
%>
<%
rsMixes.Close
Set rsMixes = Nothing
dbIntense.Close
Set dbIntense = Nothing
%>


This throws up the following error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement.
/intense/admin/register_mix.asp, line 34

(Line 34 is actually the ".Update" line before the "End With", I just took out all the rubbish from my code before posting lol)

This code works fine if I comment out the ".Fields("Date")=Now line.

The Date field in the access database is a Date/Time format.

Any suggestions anybody? could it be some setting on my server I need to change?

Any help is greatly appreciated!

Cheers,

Matthew

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 18 September 2003 :  07:21:43  Show Profile
If the field is set as a date data type, then you will need to use the # delimiters with that statement. In addition the word "Date" is a reserved word. You will need to rename that field to something else.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

underloop
Starting Member

4 Posts

Posted - 18 September 2003 :  08:26:13  Show Profile
Ahaaaa, wikkid mate, it works a treat!! I should have realised that Date was a reserved word as I was using it elsewhere in the project.... stupid me!!!

Only thing I didn't need to do was enclose it with #.... seems to work fine without it.

its been bugging me for days now, so thanks again

Matthew
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 18 September 2003 :  19:42:53  Show Profile
you're welcome!!

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07