Board index » delphi » Codes run well in IDE but get error out of IDE

Codes run well in IDE but get error out of IDE

Dear DB apps Experts,

I have the following codes that work well for paradox table, now I want to
operate VFP table
data via ODBC with them. That makes me quite confused is thing when I run
below codes in delphi's IDE, it works without any error but to execute it
out of IDE will always raise an
ODBC error says 'data type mismatch'. Could anybody help?

Ben

Attached SQL codes:

     QueryTmp.SQL.Clear;
     QueryTmp.SQL.Add('Insert into Smart_SF_Deal (PersonnelID,CardNo,
CardSerial, DateTime, System, InMoney, OutMoney, Times,
MachineNo,DateTimeToDB,DealMark,AddFare,EnterAccounts)');
     QueryTmp.SQL.Add(' values(');
     QueryTmp.SQL.Add(''''+personid+''',');          file://personnelID
     QueryTmp.SQL.Add(''''+kh+''',');               file://card no
     QueryTmp.SQL.Add(''''+CardSerial+''',');
file://cardserial
     QueryTmp.SQL.Add( '{^ '+GetSQLDateTime(Date,Time)+'},');
file://datetime for VFP TABLE
     file://QueryTmp.SQL.Add(''''+GetSQLDateTime(Date,Time)+''',');
file://DateTime FOR PARADOX TABLE
     QueryTmp.SQL.Add('''0'',');
file://system
     QueryTmp.SQL.Add(FloatToStr(OldMoney*100)+',');
     file://QueryTmp.SQL.Add(IntToStr(Round(OldMoney*100))+',');
file://InMoney
     if (Add_Sub='???') then
         QueryTmp.SQL.Add(FloatToStr((OldMoney-Money)*100)+',')
        file://QueryTmp.SQL.Add(IntToStr(Round((OldMoney-Money)*100))+',')
file://OutMoney
     else
        QueryTmp.SQL.Add(FloatToStr((OldMoney+Money)*100)+',');
file://OutMoney
     QueryTmp.SQL.Add(IntToStr(OldTimes+1)+',');
file://Times
     QueryTmp.SQL.Add('0,');
file://MachineNo
     QueryTmp.SQL.Add('{^ '+GetSQLDateTime(Date,Time)+'},');
     file://QueryTmp.SQL.Add(''''+GetSQLDateTime(Date,Time)+''',');
file://DateTimeToDB
     if (Add_Sub='???') then
        QueryTmp.SQL.Add('''3'',')
file://DealMark :draft
     else
        QueryTmp.SQL.Add('''1'',');
file://DealMark :deposit
     QueryTmp.SQL.Add(AddFareLabel.Caption+',');
file://AddFare
     QueryTmp.SQL.Add('''0'')');
file://EnterAccount
     QueryTmp.ExecSQL;

 

Re:Codes run well in IDE but get error out of IDE


Sorry ,I withdraw this post just for I've made a very low-level mistake,
that means following is not a problem!

Ben

Quote
Ben Fan <bk...@gdkehai.com> wrote in message news:3c18096c_2@dnews...
> Dear DB apps Experts,

> I have the following codes that work well for paradox table, now I want to
> operate VFP table
> data via ODBC with them. That makes me quite confused is thing when I run
> below codes in delphi's IDE, it works without any error but to execute it
> out of IDE will always raise an
> ODBC error says 'data type mismatch'. Could anybody help?

> Ben

> Attached SQL codes:

>      QueryTmp.SQL.Clear;
>      QueryTmp.SQL.Add('Insert into Smart_SF_Deal (PersonnelID,CardNo,
> CardSerial, DateTime, System, InMoney, OutMoney, Times,
> MachineNo,DateTimeToDB,DealMark,AddFare,EnterAccounts)');
>      QueryTmp.SQL.Add(' values(');
>      QueryTmp.SQL.Add(''''+personid+''',');          file://personnelID
>      QueryTmp.SQL.Add(''''+kh+''',');               file://card no
>      QueryTmp.SQL.Add(''''+CardSerial+''',');
> file://cardserial
>      QueryTmp.SQL.Add( '{^ '+GetSQLDateTime(Date,Time)+'},');
> file://datetime for VFP TABLE
>      file://QueryTmp.SQL.Add(''''+GetSQLDateTime(Date,Time)+''',');
> file://DateTime FOR PARADOX TABLE
>      QueryTmp.SQL.Add('''0'',');
> file://system
>      QueryTmp.SQL.Add(FloatToStr(OldMoney*100)+',');
>      file://QueryTmp.SQL.Add(IntToStr(Round(OldMoney*100))+',');
> file://InMoney
>      if (Add_Sub='???') then
>          QueryTmp.SQL.Add(FloatToStr((OldMoney-Money)*100)+',')
>         file://QueryTmp.SQL.Add(IntToStr(Round((OldMoney-Money)*100))+',')
> file://OutMoney
>      else
>         QueryTmp.SQL.Add(FloatToStr((OldMoney+Money)*100)+',');
> file://OutMoney
>      QueryTmp.SQL.Add(IntToStr(OldTimes+1)+',');
> file://Times
>      QueryTmp.SQL.Add('0,');
> file://MachineNo
>      QueryTmp.SQL.Add('{^ '+GetSQLDateTime(Date,Time)+'},');
>      file://QueryTmp.SQL.Add(''''+GetSQLDateTime(Date,Time)+''',');
> file://DateTimeToDB
>      if (Add_Sub='???') then
>         QueryTmp.SQL.Add('''3'',')
> file://DealMark :draft
>      else
>         QueryTmp.SQL.Add('''1'',');
> file://DealMark :deposit
>      QueryTmp.SQL.Add(AddFareLabel.Caption+',');
> file://AddFare
>      QueryTmp.SQL.Add('''0'')');
> file://EnterAccount
>      QueryTmp.ExecSQL;

Other Threads