Hello friends:
I have a doubt about the operation of a parameter.
If I create a TMSQuery with the following statement works properly and gives me back a specified number of rows
SELECT * FROM WHERE tblClientes DP =''
but if you create the senetecia like this:
SELECT * FROM WHERE tblClientes DP =: dp
ParamByName ('dp'). AsString =''
I do not return anything.
Anyone know why?
very grateful
Josep
Doubt about the operation of a parameter
-
AndreyZ
Re: Doubt about the operation of a parameter
Hello,
Please specify the following:
- the script to create the tblClientes table;
- the exact version of SDAC. You can learn it from the About sheet of TMSConnection Editor;
- the exact version of your IDE;
- the exact version of SQL Server and client. You can learn it from the Info sheet of TMSConnection Editor.
Please specify the following:
- the script to create the tblClientes table;
- the exact version of SDAC. You can learn it from the About sheet of TMSConnection Editor;
- the exact version of your IDE;
- the exact version of SQL Server and client. You can learn it from the Info sheet of TMSConnection Editor.
Re: Doubt about the operation of a parameter
Hello,
the script to create the tblClientes table;
CREATE TABLE [TblClients] (
[CodiClient] [CodiComptable] NOT NULL ,
[NomClient] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[DP] [nvarchar] (9) COLLATE Modern_Spanish_CI_AS NULL ,
[Adressa] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[Poblacio] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[AdressaAvisos] [char] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[PoblacioAvisos] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[NumComptaCte] [nvarchar] (20) COLLATE Modern_Spanish_CI_AS NULL ,
[DiaDePago] [smallint] NULL ,
[Banc] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[AdresaDelBanc] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[PoblacioDelBanc] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[Debeanyanterior] [PreuV] NULL ,
[HaberAnyAnterior] [PreuV] NULL ,
[SaldoAnyAnterior] [PreuV] NULL ,
[Comentari] [ntext] COLLATE Modern_Spanish_CI_AS NULL ,
[Comisionista] [smallint] NULL CONSTRAINT [DF_TblClients_Comisionista] DEFAULT (0),
[AcumulatDebe] [PreuV] NULL ,
[AcumulatHaber] [PreuV] NULL ,
[Saldo] [PreuV] NULL ,
[PreuOperari] [PreuV] NULL ,
[PreuAjudant] [PreuV] NULL ,
[Reclamacions] [smallint] NULL ,
[CostOperari] [PreuV] NULL ,
[CostAjudant] [PreuV] NULL ,
[Correu] [char] (50) COLLATE Modern_Spanish_CI_AS NULL ,
CONSTRAINT [PK_TblClients] PRIMARY KEY CLUSTERED
(
[CodiClient]
) WITH FILLFACTOR = 90 ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
- the exact version of SDAC. You can learn it from the About sheet of TMSConnection Editor;
Version 5.00.0.2 for Delphi 2010
- the exact version of your IDE;
Delphi 2010
- the exact version of SQL Server and client. You can learn it from the Info sheet of TMSConnection
Microsoft SQL Server 08.00.2282
Microsoft OLE DB Provider for SQL Server 06.01.7601
the script to create the tblClientes table;
CREATE TABLE [TblClients] (
[CodiClient] [CodiComptable] NOT NULL ,
[NomClient] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[DP] [nvarchar] (9) COLLATE Modern_Spanish_CI_AS NULL ,
[Adressa] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[Poblacio] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[AdressaAvisos] [char] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[PoblacioAvisos] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[NumComptaCte] [nvarchar] (20) COLLATE Modern_Spanish_CI_AS NULL ,
[DiaDePago] [smallint] NULL ,
[Banc] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[AdresaDelBanc] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[PoblacioDelBanc] [nvarchar] (30) COLLATE Modern_Spanish_CI_AS NULL ,
[Debeanyanterior] [PreuV] NULL ,
[HaberAnyAnterior] [PreuV] NULL ,
[SaldoAnyAnterior] [PreuV] NULL ,
[Comentari] [ntext] COLLATE Modern_Spanish_CI_AS NULL ,
[Comisionista] [smallint] NULL CONSTRAINT [DF_TblClients_Comisionista] DEFAULT (0),
[AcumulatDebe] [PreuV] NULL ,
[AcumulatHaber] [PreuV] NULL ,
[Saldo] [PreuV] NULL ,
[PreuOperari] [PreuV] NULL ,
[PreuAjudant] [PreuV] NULL ,
[Reclamacions] [smallint] NULL ,
[CostOperari] [PreuV] NULL ,
[CostAjudant] [PreuV] NULL ,
[Correu] [char] (50) COLLATE Modern_Spanish_CI_AS NULL ,
CONSTRAINT [PK_TblClients] PRIMARY KEY CLUSTERED
(
[CodiClient]
) WITH FILLFACTOR = 90 ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
- the exact version of SDAC. You can learn it from the About sheet of TMSConnection Editor;
Version 5.00.0.2 for Delphi 2010
- the exact version of your IDE;
Delphi 2010
- the exact version of SQL Server and client. You can learn it from the Info sheet of TMSConnection
Microsoft SQL Server 08.00.2282
Microsoft OLE DB Provider for SQL Server 06.01.7601
-
AndreyZ
Re: Doubt about the operation of a parameter
I checked this question in the following environment:, and used the following code:There was no difference in the results of both queries. Please check if you can reproduce the problem using the code above. If you can, please try creating a small sample to demonstrate the problem and send it to andreyz*devart*com .
Code: Select all
Windows 7
Delphi 2010 Version 14.0.3513.24210 Architect
SDAC Version 5.00.0.2
Microsoft SQL Server: 08.00.0194
Microsoft OLE DB Provider for SQL Server: 06.01.7600Code: Select all
MSQuery1.SQL.Text := 'SELECT * FROM TblClients WHERE DP=''''';
MSQuery1.Open;
MSQuery1.SQL.Text := 'SELECT * FROM TblClients WHERE DP=:dp';
MSQuery1.ParamByName('dp').AsString := '';
MSQuery1.Open;