Procedure 'sp_DealerPriceList' expects parameter '@userLevelNo', which was not supplied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Procedure 'sp_DealerPriceList' expects parameter '@userLevelNo', which was not supplied. Source Error: Line 99: //SqlDataAdapter sda = new SqlDataAdapter(strquary, conn); Line 100: SqlDataAdapter sda = new SqlDataAdapter('sp_DealerPriceList', conn); Line 101: sda.Fill(ds); Line 102: GridView1.DataSource = ds.Tables[0].DefaultView; Line 103: GridView1.DataBind(); Source File: c:\WebSiteash\customerdrop.aspx.cs Line: 101 Stack Trace: [SqlException (0x80131904): Procedure 'sp_DealerPriceList' expects parameter '@userLevelNo', which was not supplied.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +180 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +68 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +199 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2406 System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31 System.Data.SqlClient.SqlDataReader.get_MetaData() +62 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +294 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1095 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +314 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +20 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +107 System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +10 System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +7 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +139 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +140 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +82 customerdrop.ddlcustomer_SelectedIndexChanged(Object sender, EventArgs e) in c:\WebSiteash\customerdrop.aspx.cs:101 System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e) +75 System.Web.UI.WebControls.DropDownList.RaisePostDataChangedEvent() +124 System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent() +7 System.Web.UI.Page.RaiseChangedEvents() +138 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4512
Hi, The first line therepoints to the problem, a missing parameter. Did you need specific help with that? Salute, Mark
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; public partial class customerdrop : System.Web.UI.Page { SqlConnection conn; SqlCommand cmd; SqlDataReader dr; String sqlquary; String sqlqry; String a; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { conn = new SqlConnection(ConfigurationSettings.AppSettings['ConnectionString1']); conn.Open(); cmd = new SqlCommand('sp_DealerPriceList', conn); //SqlParameter sortParam = new SqlParameter('@SortExpression', SqlDbType.NVarChar); //sortParam.Direction = ParameterDirection.Input; //sortParam.Value = 'SortExpression'; SqlParameter sortParam1 = cmd.Parameters.Add('@userLevelNo', SqlDbType.NVarChar); sortParam1.Direction = ParameterDirection.Input; sortParam1.Value = '1'; SqlParameter sortParam2 = cmd.Parameters.Add('@CurrentUser', SqlDbType.NVarChar); sortParam2.Direction = ParameterDirection.Input; sortParam2.Value = ''; SqlParameter sortParam3 = cmd.Parameters.Add('@SelectedUser', SqlDbType.NVarChar); sortParam3.Direction = ParameterDirection.Input; sortParam3.Value = ''; SqlParameter sortParam4 = cmd.Parameters.Add('@superdealerflag', SqlDbType.NVarChar); sortParam4.Direction = ParameterDirection.Input; sortParam4.Value = ''; SqlParameter sortParam5 = cmd.Parameters.Add('@superdealer', SqlDbType.NVarChar); sortParam5.Direction = ParameterDirection.Input; sortParam5.Value = ''; SqlParameter sortParam6 = cmd.Parameters.Add('@specialuser', SqlDbType.NVarChar); sortParam6.Direction = ParameterDirection.Input; sortParam6.Value = ''; cmd.CommandType = CommandType.StoredProcedure; dr = cmd.ExecuteReader(); ddlcustomer.DataSource = dr; ddlcustomer.DataTextField = 'um_Username'; ddlcustomer.DataValueField = 'um_userid'; ddlcustomer.DataBind(); dr.Close(); conn.Close(); } } protected void ddlcustomer_SelectedIndexChanged(object sender, EventArgs e) { DataSet ds = new DataSet(); string a = ddlcustomer.SelectedValue; SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings['ConnectionString1']); conn.Open(); SqlDataAdapter sda = new SqlDataAdapter('sp_DealerPriceList', conn); sda.Fill(ds); GridView1.DataSource = ds.Tables[0].DefaultView; GridView1.DataBind(); } }
Hi, I'm still guessing, not enough info to go on, but from what you posted I'd say that either: SQL Server database objects are missing. The page that carries the userlevelno is failing, for whatever reason.