Parametized Queries on SQL Compact create garbage in tables

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
cameron
Posts: 7
Joined: Wed 27 Jun 2007 00:45

Parametized Queries on SQL Compact create garbage in tables

Post by cameron » Sat 26 Jan 2008 08:15

Hi

Im using dbexpsda30.dll with delphi 2006 connecting to SQL Compact v3.0. When executing a parametized query the resulting data in the table is garbage (ie funny characters). It is working OK if the SQL query does not use parameters.

I have a sample application that I can email to you, but in brief the following code will demonstrate the problem.

with TSQLQuery.Create(nil) do
try
SQLConnection := SQLC;
SQL.Add('INSERT INTO FLO_SETUP (MODULEID, MODULENAME, UNIQUEID, MODULETYPE)');
SQL.Add('VALUES (:MODULEID, :MODULENAME, :UNIQUEID, :MODULETYPE)');
ParamByName('MODULEID').AsInteger := 1;
ParamByName('MODULENAME').AsString := 'TEST MODULE NAME';
ParamByName('UNIQUEID').AsString := GetGuid;
ParamByName('MODULETYPE').AsString := self.Classname;
ExecSQL;
finally
Free;
end;


The resulting data is similar to the following
1 䑻㜱㝃㌶ⴷ㕅䌴㐭䐲ⴰ㜹ぃ䌭㙅䔵㤱㐵䔶 䕔呓䴠䑏䱕⁅䅎 䙔牯 NULL


Depending on the values being saved to the database it can also result in an error "raised exception class EOutOfMemory with message 'Out of memory'" in TISQLCommand30.setParameter.

It would seem that the driver is corrupting the parameters. Please review and provide a solution promptly as this issue is stopping all work for us.

thanks in advance
Cameron

cameron
Posts: 7
Joined: Wed 27 Jun 2007 00:45

Post by cameron » Sat 26 Jan 2008 20:59

i have found a fix for this now.

Post Reply