?
Solved

Error: No value given for one or more required parameters - ASP.NET C#

Posted on 2011-09-06
7
Medium Priority
?
739 Views
Last Modified: 2012-06-27
Hi,

I have a Gridview on ASP.NET C# code, I also have a DropDown control so when users pick from the Dropdown control, the Gridview will display the results.

I sat the Gridview to get the ? parameter from the Dropdown control.  The error I am getting when I chose from the Dropdown: No value given for one or more required parameters.

Any idea why?

Thank you,
RD11
0
Comment
Question by:RD11
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 19

Accepted Solution

by:
Manoj Patil earned 1336 total points
ID: 36489663
Instead of setting Parameter= ? for GridView
Use Parameter= @Parameter

For details information of the Problem. Check following link

http://stackoverflow.com/questions/2783060/c-no-value-given-for-one-or-more-required-parameter-with-formview

0
 
LVL 16

Assisted Solution

by:disrupt
disrupt earned 664 total points
ID: 36489759
You should assign a default or empty value for your dropdown
0
 

Author Comment

by:RD11
ID: 36490080
When I used @ I got an error????

I went ahead and sat the default ? to a string instead of using the Dropdown control and it worked just fine.

In the Dropdown control, I manually inputted the desired strings, and its breaking there.  In fact, when the page loads, I get the result of the preset or default string, but when I choose from the dropdown control, I get the error.  
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:RD11
ID: 36490127
Here is the Error Stack Trace
Server Error in '/' Application.
--------------------------------------------------------------------------------

No value given for one or more required parameters. 
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.OleDb.OleDbException: No value given for one or more required parameters.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 


[OleDbException (0x80040e10): No value given for one or more required parameters.]
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1006560
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +255
   System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +188
   System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +58
   System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +161
   System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) +116
   System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +4
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +130
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1297
   System.Web.UI.WebControls.AccessDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +58
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +19
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   System.Web.UI.WebControls.GridView.DataBind() +4
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
   System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +22
   System.Web.UI.WebControls.GridView.OnPreRender(EventArgs e) +17
   System.Web.UI.Control.PreRenderRecursiveInternal() +80
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Control.PreRenderRecursiveInternal() +171
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4961; ASP.NET Version:2.0.50727.4927

Open in new window

0
 
LVL 19

Assisted Solution

by:Manoj Patil
Manoj Patil earned 1336 total points
ID: 36490626
Can you post your code..... ???
0
 

Author Comment

by:RD11
ID: 36491295
I just found my issue.

In the wizard, I had a column name rather than ? under Define parameter.

Issue resolved.

Thank you for your support!
0
 

Author Closing Comment

by:RD11
ID: 36491308
Thank you
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question