Hi
I have to select the values and display in the textboxes named txtcomm and txtdate from comm table. For that I have given the coding as following.
In stored pro I have given query as
In front I have given query as
Once I run, it is showing error as
The formal parameter "@ID" was not declared as an OUTPUT parameter, but the actual parameter passed in requested output.
I have to select the values and display in the textboxes named txtcomm and txtdate from comm table. For that I have given the coding as following.
In stored pro I have given query as
Code:
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER Procedure [dbo].[sp_CommisionSelect] @ID int, @Comm decimal(2,2), @EffectiveDate datetime as Begin SELECT Comm=@Comm, EffectiveDate=@EffectiveDate FROM comm WHERE ID=@ID End
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Request.QueryString["editid"] 'If Page.IsValid Then Me.Label1.Text = Request.QueryString("editid") Dim con As SqlConnection Dim cmd, cmd1, cmd2 As New SqlCommand Dim str As String Dim rd As SqlDataReader str = "user id=sa;password=cast;database=sjc;server=AURORA-SERVER" con = New SqlConnection(str) 'Try con.Open() cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "sp_CommisionSelect" cmd.Connection = con Dim ID As New SqlParameter("@ID", SqlDbType.Int) 'ID.Direction = ParameterDirection.Output ID.Value = Label1.Text.ToString() 'CDID1.Value = CDID; Dim Comm As New SqlParameter("@Comm", SqlDbType.Decimal, 2) 'Comm.Value = Convert.ToDecimal(txtcomm.Text.ToString()) Comm.Direction = ParameterDirection.Output Dim EffectiveDate As New SqlParameter("@EffectiveDate", SqlDbType.DateTime) 'EffectiveDate.Value = CDate(txtdate.Text.ToString()) EffectiveDate.Direction = ParameterDirection.Output cmd.Parameters.Add(ID) cmd.Parameters.Add(Comm) cmd.Parameters.Add(EffectiveDate) Dim cnt As Int16 cnt = cmd.ExecuteNonQuery() 'cnt = cmd.ExecuteScalar() 'cmd1.CommandType = CommandType.StoredProcedure 'cmd1.CommandText = "sp_CommisionUpdate" 'cmd1.Connection = con 'Dim Comm1 As New SqlParameter("@Comm", SqlDbType.Decimal, 2) 'Comm1.Value = Convert.ToDecimal(txtcomm.Text.ToString()) 'Dim EffectiveDate1 As New SqlParameter("@EffectiveDate", SqlDbType.DateTime) 'EffectiveDate1.Value = CDate(txtdate.Text.ToString()) 'cmd1.Parameters.Add(Comm1) 'cmd1.Parameters.Add(EffectiveDate1) 'cmd1.ExecuteNonQuery() con.Close() 'End If End Sub
The formal parameter "@ID" was not declared as an OUTPUT parameter, but the actual parameter passed in requested output.
Comment