Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 16th, 2003, 12:55 AM
ieie ieie is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 2 ieie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
date problem

hi all...

here is my code

Set con = server.creteobject ("ADODB.Connection")
con.Open "mydb"

resultupdate = "INSERT INTO db (date) VALUES (#"&now()&"#)"

con.Execute resultupdate

But it give error -- Syntax error in INSERT INTO statement.

any idea??

thx

Reply With Quote
  #2  
Old September 8th, 2003, 06:45 PM
unatratnag unatratnag is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 312 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 6 sec
Reputation Power: 6
Send a message via AIM to unatratnag
hi ieie,
I have several ideas about possible problems....

1, you misspelled crea teobject, i assume it was a misstyping here or something since you said you can connect

2, you don't specify a name/password in your code, generally annonymous browsing is disabled but if you've enabled it, have you enabled insert commands for that user? and if so, i'd recommend changing it and not doing it that way....

3, this looks like an access query, are you using msSQL server or access?

Reply With Quote
  #3  
Old October 8th, 2003, 06:10 AM
m_lazor m_lazor is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Luxembourg
Posts: 156 m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Use spaces to make your code readable. Will help you, as well.

INSERT INTO db (date) VALUES ('" & now() & "')"
Notice the single quotes
Access uses the # to indicate datetime values. I prefer passing a string. That works also for SQL Server and others

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > date problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT