Non english Error Message
Non english Error Message
Hi, we are using dbexpsda.dll version 3.0.3.0 in an english SQL Server 2000 and english operating system (Server 2000) environment.
We get from time to time a non english (german) exception message from TSqlQueries in our application server :
'SQL Server Error: Ungültige Werte für Eingabeparameter. Weitere Informationen befinden sich in den Statuswerten.'
We checked a few DLLs like SQLOLEDB.DLL and they are all english.
Which DLLs (or other files) are involved in the communication path from the TSqlQuery object over the dbexpsda.dll up to the SQL Server 2000 which could produce this error message ?
We get from time to time a non english (german) exception message from TSqlQueries in our application server :
'SQL Server Error: Ungültige Werte für Eingabeparameter. Weitere Informationen befinden sich in den Statuswerten.'
We checked a few DLLs like SQLOLEDB.DLL and they are all english.
Which DLLs (or other files) are involved in the communication path from the TSqlQuery object over the dbexpsda.dll up to the SQL Server 2000 which could produce this error message ?
We found the place, where the error happens. The problem seems to be the way, we set a parameter to NULL in the method SetParamOrNull(). Q.ExecSQL; produces the error in the code below. Is it possible to reproduce the problem with this information ? Are we doing something wrong ?
-- Delphi
Q.SQL.Add('update CONSIGNMENT_LINE_ITEM set '+
' QTY_ASSIGNED = ' + IntToStr(cli.QtyAssigned)+','+
'PICKLIST_NUMBER = :PN,'+
'PICKLIST_VERSION_NUMBER = :PVN,'+
'RETURN_LIST_NUMBER = :RN,'+
'RETURNLIST_VERSION_NUMBER = :RVN '+
'where CLI_NUMBER = '+IntToStr(cli.CliNumber));
SetParamOrNull(Q,'PN',cli.PickListNumber);
SetParamOrNull(Q,'PVN',cli.PickListVersionNumber);
SetParamOrNull(Q,'RN',cli.ReturnListNumber);
SetParamOrNull(Q,'RVN',cli.ReturnListVersionNumber);
Q.ExecSQL;
// Helper function to set integer parameters to null if the value is zero
procedure SetParamOrNull(Q: TCMQuery; PName: String; val: Integer);
begin
if (val = 0) or (val = -1) then
begin
Q.ParamByName(PName).Datatype := ftInteger;
Q.ParamByName(PName).Clear; // set to null
Q.ParamByName(PName).Bound := TRUE;
end
else
Q.ParamByName(PName).AsInteger := val;
end;
-- SQL tablestructure
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CONSIGNMENT_LINE_ITEM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CONSIGNMENT_LINE_ITEM]
GO
CREATE TABLE [dbo].[CONSIGNMENT_LINE_ITEM] (
[CLI_NUMBER] [int] NOT NULL ,
[BCODE] [int] NULL ,
[OUT_CONSIGNMENT_NUMBER] [int] NULL ,
[IN_CONSIGNMENT_NUMBER] [int] NULL ,
[QTY_ASSIGNED] [int] NULL ,
[QTY_CHECKED_IN] [int] NULL ,
[QTY_PACKED] [int] NULL ,
[IS_ALLOCATED] [numeric](1, 0) NULL ,
[PICKLIST_NUMBER] [int] NULL ,
[RETURN_LIST_NUMBER] [int] NULL ,
[QTY_CHECKED_OUT] [int] NULL ,
[BOOKED_ITEM_NUMBER] [int] NOT NULL ,
[AVAILABILITY_AT_RESERVATION] [int] NULL ,
[AVAILABILITY_AT_ORDER] [int] NULL ,
[QTY_GRANTED] [int] NULL ,
[BQ_NUMBER] [int] NULL ,
[PICKLIST_VERSION_NUMBER] [int] NULL ,
[RETURNLIST_VERSION_NUMBER] [int] NULL
) ON [PRIMARY]
GO
-- Delphi
Q.SQL.Add('update CONSIGNMENT_LINE_ITEM set '+
' QTY_ASSIGNED = ' + IntToStr(cli.QtyAssigned)+','+
'PICKLIST_NUMBER = :PN,'+
'PICKLIST_VERSION_NUMBER = :PVN,'+
'RETURN_LIST_NUMBER = :RN,'+
'RETURNLIST_VERSION_NUMBER = :RVN '+
'where CLI_NUMBER = '+IntToStr(cli.CliNumber));
SetParamOrNull(Q,'PN',cli.PickListNumber);
SetParamOrNull(Q,'PVN',cli.PickListVersionNumber);
SetParamOrNull(Q,'RN',cli.ReturnListNumber);
SetParamOrNull(Q,'RVN',cli.ReturnListVersionNumber);
Q.ExecSQL;
// Helper function to set integer parameters to null if the value is zero
procedure SetParamOrNull(Q: TCMQuery; PName: String; val: Integer);
begin
if (val = 0) or (val = -1) then
begin
Q.ParamByName(PName).Datatype := ftInteger;
Q.ParamByName(PName).Clear; // set to null
Q.ParamByName(PName).Bound := TRUE;
end
else
Q.ParamByName(PName).AsInteger := val;
end;
-- SQL tablestructure
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[CONSIGNMENT_LINE_ITEM]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[CONSIGNMENT_LINE_ITEM]
GO
CREATE TABLE [dbo].[CONSIGNMENT_LINE_ITEM] (
[CLI_NUMBER] [int] NOT NULL ,
[BCODE] [int] NULL ,
[OUT_CONSIGNMENT_NUMBER] [int] NULL ,
[IN_CONSIGNMENT_NUMBER] [int] NULL ,
[QTY_ASSIGNED] [int] NULL ,
[QTY_CHECKED_IN] [int] NULL ,
[QTY_PACKED] [int] NULL ,
[IS_ALLOCATED] [numeric](1, 0) NULL ,
[PICKLIST_NUMBER] [int] NULL ,
[RETURN_LIST_NUMBER] [int] NULL ,
[QTY_CHECKED_OUT] [int] NULL ,
[BOOKED_ITEM_NUMBER] [int] NOT NULL ,
[AVAILABILITY_AT_RESERVATION] [int] NULL ,
[AVAILABILITY_AT_ORDER] [int] NULL ,
[QTY_GRANTED] [int] NULL ,
[BQ_NUMBER] [int] NULL ,
[PICKLIST_VERSION_NUMBER] [int] NULL ,
[RETURNLIST_VERSION_NUMBER] [int] NULL
) ON [PRIMARY]
GO
-
- Posts: 1
- Joined: Tue 28 Nov 2006 11:37