Please Help me remove the space.thanks.

Forum related to MS SQL Server

Moderators: gto, cipto_kh, EgonHugeist

storedproc
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 30.04.2018, 06:09

Please Help me remove the space.thanks.

Postby storedproc » 30.04.2018, 10:30

DELPHI 7 + zeosdbo-7.2.4-stable + MSSQL2000

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 
 


SQL

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


demo_table
demo_table.txt



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


Unit1.pas

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.


when zsp1.active:=true

MSSQL Profiler Displays the following information

Code: Select all

exec AAA_GetScore;1 'john                                                                                                                                                                                                                                                           ', 96

Here.How can I remove the space behind John in

Code: Select all

'john                                                                                                                                                                                                                                                           '
?
That is

Code: Select all

exec AAA_GetScore;1 'john', 96

Please help me.thanks.
You do not have the required permissions to view the files attached to this post.

storedproc
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 30.04.2018, 06:09

Re: Please Help me remove the space.thanks.

Postby storedproc » 02.05.2018, 08:24

when

con2: TADOConnection;
sp2: TADOStoredProc;

and sp2.active:=true

SQL Server Profiler

Code: Select all

exec AAA_GetScore;1 'john', 96


Please help me.thanks.

marsupilami
Gold Boarder
Gold Boarder
Posts: 671
Joined: 17.01.2011, 14:17

Re: Please Help me remove the space.thanks.

Postby marsupilami » 07.05.2018, 11:21

Locked because it is a duplicate of viewtopic.php?f=40&t=75217


Return to “MS SQL Server”

Who is online

Users browsing this forum: No registered users and 1 guest