Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > .NET Framework 2.0
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 12th, 2008, 02:53 PM
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
Reply With Quote
  #2 (permalink)  
Old February 12th, 2008, 03:03 PM
samjudson's Avatar
Friend of Wrox
Points: 8,436, Level: 39
Points: 8,436, Level: 39 Points: 8,436, Level: 39 Points: 8,436, Level: 39
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,084
Thanks: 1
Thanked 180 Times in 179 Posts
Default

You'll probably find that ComboBox1.SelectedItem is null.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #3 (permalink)  
Old February 12th, 2008, 03:46 PM
Friend of Wrox
 
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Good catch.... is now working....

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Resolved] Error: File used by another process snufse .NET Framework 2.0 2 February 18th, 2008 08:20 AM
(Resolved) TableAdapter Error ksamuel Pro Visual Basic 2005 1 January 16th, 2008 12:03 PM
chapter 2, error uri cannot be resolved in either boylevel BOOK: Beginning JavaServer Pages 2 November 21st, 2007 11:54 AM
SP - executing error filipczako SQL Language 3 December 12th, 2005 09:50 AM



All times are GMT -4. The time now is 03:13 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.