Passing Parrameters
Reply
![]() |
|
From:
![]() rameshpgs
|
Error showing Parrameter one is not Parrameter to storeprocedure name(sp_login).
My code is below
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click 'If txtUserId.Text = "ramesh" And txtPwd.Text = "a" Then ' Response.Redirect("reg1.aspx") 'Else ' Response.Redirect("homepage.aspx") 'End If Try Dim sp_login As String Dim cmd As New SqlCommand()
Dim p1 As New SqlParameter() Dim p2 As New SqlParameter() Dim p3 As New SqlParameter()
con.Open() cmd.Connection = con cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "sp_login"
p1.SqlDbType = SqlDbType.NVarChar p1.Direction = ParameterDirection.Input p1.Value = Trim(txtUserId.Text)
p2.SqlDbType = SqlDbType.NVarChar p2.Direction = ParameterDirection.Input p2.Value = Trim(txtPwd.Text)
p3.SqlDbType = SqlDbType.Int p3.Direction = ParameterDirection.Output
cmd.Parameters.Add(p1) cmd.Parameters.Add(p2) cmd.Parameters.Add(p3)
cmd.ExecuteNonQuery() If p3.Value = 1 Then Server.Transfer("reg1.aspx") Else Response.Write("Invalid Login") End If Catch ee As SqlException Response.Write(ee.Message) Finally con.Close() End Try End Sub
==========Stored Procedure===============
create proc sp_Login @uid varchar(30),@pwd Varchar(20),@Chk int output as begin declare cr1 cursor for select distinct username,password from Login where [EMAIL PROTECTED] and [EMAIL PROTECTED] open cr1 fetch next from cr1 into @Uid,@pwd -- if cursor_status('Variable','@cr1')<=0 while @@fetch_status=0 begin --set @chk=0 set @chk=1 fetch next from cr1 into @Uid,@pwd end close cr1 deallocate cr1 --print @chk end ===============================================================================
declare @dec int exec sp_login 'ram','a',@dec output print @dec
insert into Login values('ram','a')
pl'e tell me where went wrong thanks in advance Ramesh |
|
View other groups in this category.
![]() |
To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.
Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.
If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.
|
|