Please Help me remove the space.thanks.
Posted: 30.04.2018, 10:30
DELPHI 7 + zeosdbo-7.2.4-stable + MSSQL2000
MSSQL
SQL
demo_table
TZConnection Protocol := mssql
Unit1.dfm
Unit1.pas
when zsp1.active:=true
MSSQL Profiler Displays the following information
Here.How can I remove the space behind John in ?
That is
Please help me.thanks.
MSSQL
Code: Select all
Host:127.0.0.1
User:sa
password:zeoslib
DATABASE NAME:tzstoredproc_demo
tzstoredproc_demo
-> table name: demo_table
-> sql stored procedure AAA_GetScore
Code: Select all
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[AAA_GetScore]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
dro p procedure [dbo].[AAA_GetScore]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[demo_table]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
dro p table [dbo].[demo_table]
GO
CREATE TABLE [dbo].[demo_table] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[fullid] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[name] [char] (255) COLLATE Chinese_PRC_CI_AS NULL ,
[subject] [char] (255) COLLATE Chinese_PRC_CI_AS NULL ,
[score] [int] NULL
) ON [PRIMARY]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE AAA_GetScore
@Name varchar(8000) ,
@score integer
AS
select * from demo_table where name=@name and score=@score
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
TZConnection Protocol := mssql
Unit1.dfm
Code: Select all
object Form1: TForm1
Left = 339
Top = 160
Width = 720
Height = 395
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object dbgrd1: TDBGrid
Left = 56
Top = 112
Width = 649
Height = 169
DataSource = ds1
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'Tahoma'
TitleFont.Style = []
end
object ds1: TDataSource
DataSet = zsp1
Left = 80
Top = 24
end
object con1: TZConnection
ControlsCodePage = cCP_UTF8
Properties.Strings = (
'controls_cp=CP_UTF8')
Connected = True
HostName = '127.0.0.1'
Port = 0
Database = 'tzstoredproc_demo'
User = 'sa'
Password = 'zeoslib'
Protocol = 'mssql'
Left = 152
Top = 24
end
object zsp1: TZStoredProc
Connection = con1
Active = True
Params = <
item
DataType = ftInteger
Name = '@RETURN_VALUE'
ParamType = ptResult
Value = 0
end
item
DataType = ftString
Name = '@Name'
ParamType = ptInput
Value = 'john'
end
item
DataType = ftInteger
Name = '@score'
ParamType = ptInput
Value = '96'
end>
StoredProcName = 'AAA_GetScore;1'
Left = 232
Top = 24
ParamData = <
item
DataType = ftInteger
Name = '@RETURN_VALUE'
ParamType = ptResult
Value = 0
end
item
DataType = ftString
Name = '@Name'
ParamType = ptInput
Value = 'john'
end
item
DataType = ftInteger
Name = '@score'
ParamType = ptInput
Value = '96'
end>
end
end
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ZAbstractRODataset, ZAbstractDataset, ZStoredProcedure,
ZAbstractConnection, ZConnection, Grids, DBGrids;
type
TForm1 = class(TForm)
ds1: TDataSource;
con1: TZConnection;
zsp1: TZStoredProc;
dbgrd1: TDBGrid;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.
MSSQL Profiler Displays the following information
Code: Select all
exec AAA_GetScore;1 'john ', 96
Code: Select all
'john '
That is
Code: Select all
exec AAA_GetScore;1 'john', 96