View Single Post
 
Old February 12th, 2008, 03:53 PM
snufse snufse is offline
Friend of Wrox
 
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default [Resolved] Error calling a sp - parameter error

I am calling a stored procedure and get parameter error. I do not see where the problem is. Error is:

System.Data.SqlClient.SqlException: Procedure 'sp_Vecellio_JobComparison' expects parameter '@PlantId', which was not supplied

[u]VB Code:</u>
Code:
            EquentialCommand.Parameters.Add(New SqlClient.SqlParameter("@PathFileName", SqlDbType.Char)).Value = AbsolutePath
            EquentialCommand.Parameters.Add(New SqlClient.SqlParameter("@DateFrom", SqlDbType.DateTime)).Value = DateTimePicker1.Text
            EquentialCommand.Parameters.Add(New SqlClient.SqlParameter("@DateTo", SqlDbType.DateTime)).Value = DateTimePicker2.Text
            EquentialCommand.Parameters.Add(New SqlClient.SqlParameter("@PlantId", SqlDbType.Char)).Value = ComboBox1.SelectedItem
            EquentialCommand.Parameters.Add(New SqlClient.SqlParameter("@JobNumber", SqlDbType.Int)).Value = CInt(TextBox1.Text)
            If ComboBox1.SelectedItem <> Nothing Then
                If ComboBox1.SelectedItem = "All Plants" Then
                    EquentialCommand.Parameters.Item("@PlantId").Value = ComboBox1.SelectedItem
                Else
                    EquentialCommand.Parameters.Item("@PlantId").Value = JobPrefixes(0)
                End If
            Else
                If TextBox1.Text <> Nothing Then
                    EquentialCommand.Parameters.Item("@JobNumber").Value = TextBox1.Text
                End If
            End If
            EquentialCommand.CommandType = CommandType.StoredProcedure
            EquentialCommand.CommandText = ("sp_Vecellio_JobComparison")
            EquentialCommand.Connection = EquentialConnection
            mySqlDataAdapter.SelectCommand = EquentialCommand
            mySqlDataAdapter.Fill(mySqlDataSet, "JobListTable")
            EquentialCommand.Parameters.Clear()
            EquentialConnection.Close()


[u]Stored Procedure:</u>
Code:
CREATE PROCEDURE sp_Vecellio_JobComparison
@PathFileName varchar(200),
@DateFrom datetime,
@DateTo datetime,
@PlantId char(3),
@JobNumber int