Board index » delphi » help:I think maybe it's a bug for delphi

help:I think maybe it's a bug for delphi

my system:win2000 server/SQL Server2000/Delphi 6.0
I use Midas to construct my system . In Application server ?I use ADO to
connetion Database ,
I use TADOconnetion/TADOstoredProc/Tdatasetprovider . The Procedure is
mainly used to insert record into tables, it has some parameters to receive
data .
 In client Application ,I use TclientDataset to connect Tdatasetprovider
.Now one error takes place ,when I input English or number ,program run
correctly ,but If I input Chinese ,It just post a few words from beginning
stochasticly ,the information is not full. The length of the field in
database and Procedure is enough ,this error occurs not because of length.
    I have done some tests ,the Procedure is correct when I run it in SQL
Server ,the database is correct ,when I  use TADOtable or TADOquery instead
of TADOstoredProc ,the result is correct.
I think maybe some problem exit between TADOstoredProc and Tdatasetprovider
,or maybe some others.
I need some help.
 

Re:help:I think maybe it's a bug for delphi


my proc in SQL Server is :
create proc CreatePerson
       @UserID    varchar(32),
       @name      varchar(64),
       @password  varchar(64),
       @email     varchar(128),
       @address    varchar(128),
       @desc      varchar(64),
       @PersonID  int  output

as
if(LTRIM(@Userid)='') return

BEGIN TRANSACTION  sp_CreatePerson
  declare @sysid  int
 insert into PDMSYSOBJECT(CREATER,LASTMODIFIER,SYSOBJECTTYPEID)
             values(current_user ,current_user,12)
 if(@@rowcount=0)
 begin
   select @Personid=0
   ROLLBACK TRANSACTION sp_CreatePerson
   return
 end
 else
 begin
   select @sysid=@@IDENTITY
   insert Person(SYSOBJECTID,UserId,NAME,Password,Email,address,DESCRIPTION)
          values(@sysid,@UserID,@name,@Password,@email,@address,@desc)
   if(@@rowcount=0)
   begin
     select @Personid=0
     ROLLBACK TRANSACTION sp_Createperson
     return
   end
   else
    COMMIT TRANSACTION sp_Createperson

 end
***in middle tier I use TADOStoredProc to connect the proc.
***in the client application I use Tclientdataset to obtain the value of
parameters.
          FetchParams;
          close;
          Params.ParamByName('@UserID').AsString:=dbedit7.Text;
          Params.ParamByName('@name').AsString:=dbedit1.text;;
          Params.ParamByName('@password').AsString:=dbedit2.Text;
          Params.ParamByName('@email').AsString:=dbedit3.Text;
          Params.ParamByName('@address').AsString:=dbedit4.Text;
          Params.ParamByName('@desc').AsString:=dbedit6.Text;
          execute;
after execute some information can be received by database server,but the
clientdataset can't applyupdates,so the datasetprovider in middle tier can't
update ,I think just because of this some problem occurs .
  I need some help ,can I use this proc? is this proc correct?
are there some quetions in the whole process?

thanks for any help!
regards.

Re:help:I think maybe it's a bug for delphi


try use "set nocount on" in yr proc.
"chweidong" <c_weid...@hotmail.com> D????D???:3d210bb3_1@dnews...
Quote
> my proc in SQL Server is :
> create proc CreatePerson
>        @UserID    varchar(32),
>        @name      varchar(64),
>        @password  varchar(64),
>        @email     varchar(128),
>        @address    varchar(128),
>        @desc      varchar(64),
>        @PersonID  int  output

> as
> if(LTRIM(@Userid)='') return

> BEGIN TRANSACTION  sp_CreatePerson
>   declare @sysid  int
>  insert into PDMSYSOBJECT(CREATER,LASTMODIFIER,SYSOBJECTTYPEID)
>              values(current_user ,current_user,12)
>  if(@@rowcount=0)
>  begin
>    select @Personid=0
>    ROLLBACK TRANSACTION sp_CreatePerson
>    return
>  end
>  else
>  begin
>    select @sysid=@@IDENTITY
>    insert

Person(SYSOBJECTID,UserId,NAME,Password,Email,address,DESCRIPTION)

- Show quoted text -

Quote
>           values(@sysid,@UserID,@name,@Password,@email,@address,@desc)
>    if(@@rowcount=0)
>    begin
>      select @Personid=0
>      ROLLBACK TRANSACTION sp_Createperson
>      return
>    end
>    else
>     COMMIT TRANSACTION sp_Createperson

>  end
> ***in middle tier I use TADOStoredProc to connect the proc.
> ***in the client application I use Tclientdataset to obtain the value of
> parameters.
>           FetchParams;
>           close;
>           Params.ParamByName('@UserID').AsString:=dbedit7.Text;
>           Params.ParamByName('@name').AsString:=dbedit1.text;;
>           Params.ParamByName('@password').AsString:=dbedit2.Text;
>           Params.ParamByName('@email').AsString:=dbedit3.Text;
>           Params.ParamByName('@address').AsString:=dbedit4.Text;
>           Params.ParamByName('@desc').AsString:=dbedit6.Text;
>           execute;
> after execute some information can be received by database server,but the
> clientdataset can't applyupdates,so the datasetprovider in middle tier
can't
> update ,I think just because of this some problem occurs .
>   I need some help ,can I use this proc? is this proc correct?
> are there some quetions in the whole process?

> thanks for any help!
> regards.

Other Threads