Board index » delphi » Update-statement and date/time-fields
Suuronen Henri
![]() Delphi Developer |
Fri, 09 Mar 2001 03:00:00 GMT
|
Suuronen Henri
![]() Delphi Developer |
Fri, 09 Mar 2001 03:00:00 GMT
Update-statement and date/time-fields
I'm trying to update an MS Access-database using the following SQL:
UPDATE Table1 SET Table1.Time1=#9/21/1998 4:03:04 PM# This works fine when run from Access but when run from my application What could be wrong? Does it have something to do with BDE? Without the Any help is well appreciated. -- |
Michael Glat
![]() Delphi Developer |
Fri, 09 Mar 2001 03:00:00 GMT
Re:Update-statement and date/time-fieldsWhat is happening is that delphi is seeing the colon : before the 03:04 and thinking that you are trying to pass a parameter. What you should do is either put quotes around the date/time you are trying to pass or put it into a parameter - UPDATE Table1 SET Table1.Time1= :YOURDATETIME or something like that. -- QuoteSuuronen Henri wrote in message <36064FC3.6EFFA...@ej.insta.fi>... |
Steve Koters
![]() Delphi Developer |
Fri, 09 Mar 2001 03:00:00 GMT
Re:Update-statement and date/time-fieldsOn Mon, 21 Sep 1998 16:08:19 +0300, Suuronen Henri Quote<henri.suuro...@ej.insta.fi> wrote: False. Microsoft Access uses a number of different nonstandard syntax conventions, ////////////////////////////////////////////////////////////////////////// |
Suuronen Henr
![]() Delphi Developer |
Sat, 10 Mar 2001 03:00:00 GMT
Re:Update-statement and date/time-fieldsNow this is strange.... As Michael Glatz correctly stated I should use quotes around my datetime-value. The following works perfectly: UPDATE Table1 SET Table1.Time1="9/21/1998 4:03:04 PM" So what's strange? The fact that Access wants it's dates surrounded with -- |
Suuronen Henr
![]() Delphi Developer |
Sat, 10 Mar 2001 03:00:00 GMT
Re:Update-statement and date/time-fieldsQuoteMichael Glatz wrote: UPDATE Table1 SET Table1.Time1 = "#9/21/1998 4:03:04 PM#" -> type mismatch UPDATE Table1 SET Table1.Time1 = #"9/21/1998 4:03:04 PM"# -> syntax error in date Why is BDE trying to preprocess the query? Is there any way to avoid -- |
Suuronen Henr
![]() Delphi Developer |
Sat, 10 Mar 2001 03:00:00 GMT
Re:Update-statement and date/time-fieldsQuoteSteve Koterski wrote: I'm a little confused about this: these kind of extensions for SQL work A previous reply suggested it had something to do with parameters in -- |
Steve Koters
![]() Delphi Developer |
Sun, 11 Mar 2001 03:00:00 GMT
Re:Update-statement and date/time-fieldsOn Tue, 22 Sep 1998 08:46:59 +0300, Suuronen Henri Quote<henri.suuro...@ej.insta.fi> wrote: Quote>I tried setting the RequestLive-property to false but it didn't help. Access driver. Use the BDE Administrator to check or change this parameter. If this parameter is currently set to LOCAL (or not set at all), try setting it to SERVER. Quote>I'm a little confused about this: these kind of extensions for SQL work Basic are all made by the same company (Microsoft). If a company chooses to use nonstandard SQL syntax in its database back-end, I would expect their own front-end applications to support the same nonstandard syntax -- no matter what effect this might have on the front-end products of any other company. Just because this nonstandard syntax works in a Microsoft product does not make it any less a deviation from standard SQL. Try using pound signs to delimit DATE literals in SQL for any other database type (Oracle, Sybase, InterBase, Informix, or what-have-you). This is one of the drawbacks of implementing nonstandard syntax. Other Quote>... Is BDE is actually generated? I suspect an EDBEngineError. Try using exception handling to trap the error. Parse the EDBEngineError exception object to get more information on the error. The EDBEngineError.Errors property will contain one or more TDBError objects, each reflecting a different error for the same error condition. The TDBError object has a NativeError property. If this property has a value, it could well indicate the error is being raised by the Access data engine, and not the BDE. Whichever one initiates the error, it will still be passed back to the application through the BDE and become accessible to the front-end application as an EDBEngineError exception object. Quote>...And can't sleight-of-hand on the part of the BDE. The result set is really a static, read-only set of rows and columns. When you change data values (programmatically or through visual data controls), the BDE composes statements to apply the updates to the base table (after which the result set is refreshed to reflect the changes), these statements executed invisibly in the background. In order to properly compose those updating statements and update the correct rows in the base table, the original statement used to retrieve the data is used, and that statement must be usable to the BDE. A decision was made to use industry-accepted standards for SQL in the So often the choice may boil down to one of: A. Use standard SQL and a live query. B. Use nonstandard and a read-only query. The latter can, of course, be overcome using a TClientDataSet component Quote>A previous reply suggested it had something to do with parameters in when the colons do not denote a parameter), set the TQuery.ParamCheck property to False. (In older versions, before advent of the ParamCheck property, you had to double up the colons.) ////////////////////////////////////////////////////////////////////////// |
1. Date Time Field, accessing Date xor Time only?
2. How to create DATE FIELD OR TIME FIELD ?
3. Getting Date/Time from LAN Machine and Setting Date/Time on Client
4. Query for last date/time and date/time in ASC format
5. 'select' statements and date fields
6. SQL statements and Date fields...
7. Date Fields on paradox sql statements
8. Update or Insert statement to fill a BLOB field
9. BDE 5.10 Update SQL statement delete the 2nd and 3rd memo fields on my table