Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 3rd, 2003, 02:34 PM
DerFarm DerFarm is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 1 DerFarm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
SQL apparently not executing

Code:

  If SQL > "" Then CurrentDb().Execute (SQL)


SQL is a text string that updates specific fields of specific records.

The above code gets executed when the "Save With Exit" command button is clicked. The SQL is kosher ... that is, when cut and pasted into a query in the access database, it runs with no errors and the appropriate record gets updated.

The problem is, when it is run from code, "CurrentDb().Execute (SQL)" the changes are NOT evident in the table.

Note: I have also used DoCmd.RunSQL(SQL)

No error messages are given.

ANy suggestions?

Reply With Quote
  #2  
Old July 3rd, 2003, 08:28 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
What language are you using?
Have you setup all the connection and recordset object correctly.
If you're using ASP, I believe the correct code should be:
objDBcon.Execute(strSQL) - ie. remove the braces after your conn object.
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #3  
Old August 5th, 2003, 01:24 PM
rdoekes rdoekes is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Strasbourg, France
Posts: 181 rdoekes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 20 sec
Reputation Power: 7
Send a message via AIM to rdoekes Send a message via Yahoo to rdoekes
if I am not mistaken and you are using asp than the correct syntax for executing a sql statement without a recordset is
Code:
CurrentDB.Execute strSQL


If you are using a row returning recordset than the correct syntax is:
Code:
Set oRS = CurrentDB.Execute(strsQL)


So in case of a recordset you need the brackets.
__________________
- Rogier Doekes

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > SQL apparently not executing


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 5 hosted by Hostway
Stay green...Green IT