Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Problem with update and date
Sat, Nov 7 2009 1:29 PMPermanent Link

"EŽEletronic"
with QryAlter do
       begin
         SQL.Clear;
         SQL.Text := 'UPDATE ADesloc SET  CodData = ' +
DMPM.TblAtend.FieldByName('CodData').AsString +
           ' where BopN = ' + QryNumBop.FieldByname('BopN').AsString;
         ExecSQL;

How to solve the problem with this query?
below the error:
---------------------------
Bopmes
---------------------------
DBISAM Engine Error # 11949 SQL parsing error - Expected NULL, Date, or
Timestamp expression but instead found / in UPDATE SQL statement at line 1,
column 36.
---------------------------
OK
---------------------------
EGŽ

Sun, Nov 8 2009 5:50 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

EŽEletronic


As a guess it will be the date format you've used. Dates for the newer versions of DBISAM have to be in ANSI format ie YYYY-MM-DD

Roy Lambert [Team Elevate]
Sun, Nov 8 2009 11:11 AMPermanent Link

"EŽEletronic"
Ok Roy, I'm using version 4.17 and utlize this function to convert the date,
but still get an error. compiles normally only happens when you run the
query.
---
function DateToSql(Data: TDateTime): String;
begin
Result := QuotedStr(FormatDateTime('YYYY-MM-DD', Data));
end;
-----
SQL.Clear;
         SQL.Text := 'UPDATE ADesloc SET  CodData = ' +
DateToSql(DMPM.TblAtend.FieldByName('CodData').AsDateTime) +
           ' where BopN = ' + QryNumBop.FieldByname('BopN').AsString;
         ExecSQL;  ''''
---------------------------
Debugger Exception Notification
---------------------------
Project BOPMES.exe raised exception class EDBISAMEngineError with message
'DBISAM Engine Error # 11949 SQL parsing error - Expected NULL, Memo
expression but instead found / in UPDATE SQL statement at line 1, column
61'. Process stopped. Use Step or Run to continue.
---------------------------
OK   Help
---------------------------
"Roy Lambert" <roy.lambert@skynet.co.uk> escreveu na mensagem
news:1B15AF1A-5F83-4DED-B9B0-B60FD827533C@news.elevatesoft.com...
> EŽEletronic
>
>
> As a guess it will be the date format you've used. Dates for the newer
> versions of DBISAM have to be in ANSI format ie YYYY-MM-DD
>
> Roy Lambert [Team Elevate]
>

Sun, Nov 8 2009 1:00 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

EŽEletronic


The error position has moved from 36 to 61 so a wild guess would be BopN is a date field and QryNumBop.FieldByname('BopN').AsString also needs to be in the right format.

Roy Lambert [Team Elevate]
Sun, Nov 8 2009 1:34 PMPermanent Link

"EŽEletronic"
Roy, Thanks, the problem was occurring in the second field. resolved.
EGŽ

"Roy Lambert" <roy.lambert@skynet.co.uk> escreveu na mensagem
news:B2188833-CE19-4128-9857-E9A9A52139A1@news.elevatesoft.com...
> EŽEletronic
>
>
> The error position has moved from 36 to 61 so a wild guess would be BopN
> is a date field and QryNumBop.FieldByname('BopN').AsString also needs to
> be in the right format.
>
> Roy Lambert [Team Elevate]
>

Mon, Nov 9 2009 7:58 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< Ok Roy, I'm using version 4.17 and utlize this function to convert the
date, but still get an error. compiles normally only happens when you run
the query. >>

Just so you know, you can use these TDBISAMEngine methods to convert
dates/times to the proper format:

http://www.elevatesoft.com/manual?action=mancompmethod&id=dbisam4&product=d&version=7&comp=TDBISAMEngine&method=DateToAnsiStr

http://www.elevatesoft.com/manual?action=mancompmethod&id=dbisam4&product=d&version=7&comp=TDBISAMEngine&method=DateTimeToAnsiStr

http://www.elevatesoft.com/manual?action=mancompmethod&id=dbisam4&product=d&version=7&comp=TDBISAMEngine&method=TimeToAnsiStr

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Nov 10 2009 5:03 AMPermanent Link

"EŽEletronic"
Thanks Tim, the DBISam is an excellent tool.
EGŽ
"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> escreveu na
mensagem news:0CD27FE5-671E-4578-AAE8-08A6DA6C41BD@news.elevatesoft.com...
>
> << Ok Roy, I'm using version 4.17 and utlize this function to convert the
> date, but still get an error. compiles normally only happens when you run
> the query. >>
>
> Just so you know, you can use these TDBISAMEngine methods to convert
> dates/times to the proper format:
>
> http://www.elevatesoft.com/manual?action=mancompmethod&id=dbisam4&product=d&version=7&comp=TDBISAMEngine&method=DateToAnsiStr
>
> http://www.elevatesoft.com/manual?action=mancompmethod&id=dbisam4&product=d&version=7&comp=TDBISAMEngine&method=DateTimeToAnsiStr
>
> http://www.elevatesoft.com/manual?action=mancompmethod&id=dbisam4&product=d&version=7&comp=TDBISAMEngine&method=TimeToAnsiStr
>
> --
> Tim Young
> Elevate Software
> www.elevatesoft.com
>

Image