Invalid precision value

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Invalid precision value

Post by oz8hp » Tue 06 Jul 2010 12:46

I have the following code that runs very fine on MySQL but when I try on Access I get an error saying:
[Microsoft][ODBC Microsoft Access Driver]Invalid precision value


procedure ErrorWriteDB(Const aText : String);
var
Query: TUniQuery;
begin
if aText = '' then
Exit;
Query := TUniQuery.Create(Nil);
Query.Connection := frmDBConn.conDBserver;
try
Query.SQL.Clear;
Query.SQL.Add('INSERT INTO ' + TableLogError);
Query.SQL.Add('(fldError_Time, fldError_Computer, fldError_Software, fldError_Text)');
Query.SQL.Add('values (:fldError_Time, :fldError_Computer, :fldError_Software, :fldError_Text)');
try
begin
Query.ParamByName('fldError_Time').AsDateTime := Now;
Query.ParamByName('fldError_Computer').AsString := Network.ComputerName;
Query.ParamByName('fldError_Software').AsString := conProgram_Name + ' v ' + Exe.Version + ' build ' + Exe.Build;
Query.ParamByName('fldError_Text').AsString := aText;
Query.Execute;
end;
except
on E:Exception do
Logfile.Error('Errorlog: ' + E.Message);
end;
finally
Query.UnPrepare;
Query.Free;
Application.ProcessMessages;
end;
end;

Any input to what is wrong here?

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Wed 07 Jul 2010 14:11

Hello

To reproduce your issue I need the DDL script for creating the table where you are inserting data. Also I need the values of the Network.ComputerName, conProgram_Name, Exe.Version, Exe.Build, aText variables.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Post by oz8hp » Thu 08 Jul 2010 12:55

I think I have narrowed the problem down to the fact that Access can only handle 255 chars i text field.

But I am not quite sure yet.

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Fri 09 Jul 2010 14:16

Yes, Access database doesn't allow to create text fields with size more then 255 chars. You can use the Memo data type to store large data in the text format.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Post by oz8hp » Mon 12 Jul 2010 08:01

Of course!

In Denmark we often say 'I didn't see the forrest because of all the trees' :D

TNX

Post Reply