Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Output Parameters -- ARRRGGHHH!!


Message #1 by playhard@m... on Sat, 20 Jan 2001 03:52:54 -0000
Can anyone tell me why I might be getting the following error message with

the below code?



ERROR MESSAGE:

Error Type:

ADODB.Command (0x800A0BB9)

Arguments are of the wrong type, are out of acceptable range, or are in

conflict with one another.



ASP CODE:

Set objConnection = Server.CreateObject("ADODB.Connection")

objConnection.Open("DSN=SAP; DRIVER={SQL Server}; UID=anyone;

PWD=password")



Set objCommand = Server.CreateObject("ADODB.Command")

With objCommand

  .ActiveConnection = objConnection

  .CommandText = "sp_ResetPass"

  .CommandType = adCmdStoredProc

  Call .Parameters.Append(.CreateParameter("@Param1", adChar,adParamInput,

20, strUsername))

  Call .Parameters.Append(.CreateParameter("@Param2", adChar,adParamInput,

10, strNewPass))

  Call .Parameters.Append(.CreateParameter("@Param3", adChar,adParamInput,

10, strOldPass))

  Call .Parameters.Append(.CreateParameter("@Param4",

adChar,adParamOutput, 1, t_ExistOut))



'Response.Write Param4.Value



End With



objConnection.Close



Set objCommand = Nothing

Set objConnection = Nothing



STORED PROCDURE:



CREATE PROCEDURE dbo.sp_ResetPass



@t_UsernamePass char(20)= null,

@t_NewPass char(10)= null,

@t_OldPass char(10)= null,

@t_ExistOut char(1) OUTPUT



AS



DECLARE @t_Person int 

SET @t_Person = null

Select @t_Person = PerID

From PersonApplication AS pa

Where (pa.Username = @t_UsernamePass) AND (pa.Password = @t_OldPass)



IF @t_Person = null

BEGIN

SELECT  @t_ExistOut = 'n'

RETURN

END



ELSE

BEGIN

UPDATE  PersonApplication

SET Password = @t_NewPass

SELECT @t_ExistOut = 'y'

END

Message #2 by "Daniel Maloney" <dmaloney@a...> on Sat, 20 Jan 2001 03:15:56 -0600
The only I time I get that error message is that if the data I am using to

pass into a input parameter is greater than the length specified..  I have

not gotten that error message at any other time..



Thank You,



Daniel



-----Original Message-----

From: playhard@m... [mailto:playhard@m...]

Sent: Friday, January 19, 2001 9:53 PM

To: ASP Databases

Subject: [asp_databases] Output Parameters -- ARRRGGHHH!!





Can anyone tell me why I might be getting the following error message with

the below code?



ERROR MESSAGE:

Error Type:

ADODB.Command (0x800A0BB9)

Arguments are of the wrong type, are out of acceptable range, or are in

conflict with one another.



ASP CODE:

Set objConnection = Server.CreateObject("ADODB.Connection")

objConnection.Open("DSN=SAP; DRIVER={SQL Server}; UID=anyone;

PWD=password")



Set objCommand = Server.CreateObject("ADODB.Command")

With objCommand

  .ActiveConnection = objConnection

  .CommandText = "sp_ResetPass"

  .CommandType = adCmdStoredProc

  Call .Parameters.Append(.CreateParameter("@Param1", adChar,adParamInput,

20, strUsername))

  Call .Parameters.Append(.CreateParameter("@Param2", adChar,adParamInput,

10, strNewPass))

  Call .Parameters.Append(.CreateParameter("@Param3", adChar,adParamInput,

10, strOldPass))

  Call .Parameters.Append(.CreateParameter("@Param4",

adChar,adParamOutput, 1, t_ExistOut))



'Response.Write Param4.Value



End With



objConnection.Close



Set objCommand = Nothing

Set objConnection = Nothing



STORED PROCDURE:



CREATE PROCEDURE dbo.sp_ResetPass



@t_UsernamePass char(20)= null,

@t_NewPass char(10)= null,

@t_OldPass char(10)= null,

@t_ExistOut char(1) OUTPUT



AS



DECLARE @t_Person int

SET @t_Person = null

Select @t_Person = PerID

From PersonApplication AS pa

Where (pa.Username = @t_UsernamePass) AND (pa.Password = @t_OldPass)



IF @t_Person = null

BEGIN

SELECT  @t_ExistOut = 'n'

RETURN

END



ELSE

BEGIN

UPDATE  PersonApplication

SET Password = @t_NewPass

SELECT @t_ExistOut = 'y'

END




  Return to Index