Board index » delphi » stored procedure with MS SQL 6.5

stored procedure with MS SQL 6.5

Hi,

I am using Delphi 3 and trying to execute the following stored procedure in
Sql server.

sp_password NULL, newpass, loginame

The NULL argument allows the sa to reset the new password of 'loginame' to
the new password regardless of the previous password.

However, I have trouble passing NULL as parameter, I have tried:

params.ParamByName('@old').AsString := 'NULL';
 params.ParamByName('@new').AsString := 'newpass';
 params.ParamByName('@loginame').AsString := 'loginame';
 ExecProc;

But it complains that the old password is not correct.

Anybody know how can I achieve this?

Thanks!

-ernest

 

Re:stored procedure with MS SQL 6.5


Quote
> Hi,

> I am using Delphi 3 and trying to execute the following stored procedure in
> Sql server.

> sp_password NULL, newpass, loginame

> The NULL argument allows the sa to reset the new password of 'loginame' to
> the new password regardless of the previous password.

> However, I have trouble passing NULL as parameter, I have tried:

> params.ParamByName('@old').AsString := 'NULL';
>  params.ParamByName('@new').AsString := 'newpass';
>  params.ParamByName('@loginame').AsString := 'loginame';
>  ExecProc;

> But it complains that the old password is not correct.

> Anybody know how can I achieve this?

> Thanks!

> -ernest

  Just clear the param, i.e

params.ParamByName('@old).Clear;

If it doesn't work (@old value is unknown type) just initilize it with the
right type like
params.ParamByName('@old).AsInteger := 0 if @old is an integer or
params.ParamByName('@old).AsString := '' if it is a string and call the clear
method

Re:stored procedure with MS SQL 6.5


On Sun, 8 Feb 1998 14:19:36 +0800, "Ernest Chen"

Quote
<ec...@spyderware.com> wrote:
>Hi,

>I am using Delphi 3 and trying to execute the following stored procedure in
>Sql server.

>sp_password NULL, newpass, loginame

>The NULL argument allows the sa to reset the new password of 'loginame' to
>the new password regardless of the previous password.

>However, I have trouble passing NULL as parameter, I have tried:

>params.ParamByName('@old').AsString := 'NULL';

Use params.ParamByName('@old').Clear.

Julian van Tubbergh.

Re:stored procedure with MS SQL 6.5


params.ParamByName('@old').Clear

might be what you're looking for?  set up your parameter to allow nulls too
(a checkbox in the parameter property editor).

HTH

Cheers,
Kevin.

Quote
Ernest Chen wrote in message <6bjima$ac...@smtp.hkone.net>...
>Hi,

>I am using Delphi 3 and trying to execute the following stored procedure in
>Sql server.

>sp_password NULL, newpass, loginame

Other Threads