Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 4th, 2009, 03:19 AM
Registered User
 
Join Date: Mar 2009
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default Exception: Procedure or Function 'sp_ViewSelectedtbJD' expects parameter '@FileNumber

Exception: Procedure or Function 'sp_ViewSelectedtbJD' expects parameter '@FileNumber' which was not supplied

Code:
private void SelectedRecordsCount()
        {
            conn = new SqlConnection(@connectionString);
            DataTable dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter();
            SqlCommand cmd = new SqlCommand("sp_ViewSelectedtbJD");
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@nvarFileID", SqlDbType.Int, 4);
            foreach (DataGridViewRow row in dgvViewJDRecords.SelectedRows)
            {
                cmd.Parameters.Add("@nvarFileID", SqlDbType.Int, 4).Value = Convert.ToInt32(row.Cells["FileNumber"].Value);
                //cmd.Connection = conn;
                //da.SelectCommand = cmd;
                //da.Fill(dt);
            }
            cmd.Connection = conn;
            da.SelectCommand = cmd;
            da.Fill(dt);
            //foreach (DataGridViewRow row in dgvViewJDRecords.SelectedRows)
            //{
            //    cmd.Parameters["@nvarFileID"].Value = Convert.ToInt32(row.Cells["FileNumber"].Value);
            //}
            //da.Fill(dt);
        }
 
Old March 4th, 2009, 06:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

so? you are not supplying it.
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameter Count Exception prateekcool007 C# 0 July 26th, 2007 11:05 AM
Query Parameter of a Stored Procedure tarang SQL Server 2000 4 July 25th, 2007 11:43 AM
ERROR: Procedure or Function 'x' expects paramater rsearing ASP.NET 2.0 Basics 7 March 3rd, 2007 07:02 AM
Parameter Expects sureshbabu Classic ASP Databases 15 September 17th, 2004 03:14 AM
out parameter from procedure??? cgpedja Access 2 July 8th, 2004 01:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.