Insert Error after binding SQLCe database to asp dataview form in Visual Web Developer 2008

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I just started using VisWebDev 2008 and in a small test, I added a small SQLCe database to the website and then added a DetailsView table to the page and linked it to the database. I enabled editing. When I run the page, I can page through data, I can insert
new records fine, but when I chose to edit a row of data, after I make a change and then click "update", I get the following error.
It does not matter whether I use a DetailsView, Gridview etc. and It does not matter which field in any row that I update - Please help!
<span><span style="font-family:Arial,Helvetica,Geneva,SunSans-Regular,sans-serif <span style="font-family:Verdana 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.
<br/>
<br/>
<span style="font-family:Verdana Exception Details: System.ArgumentException: The SqlCeParameter with this name is already contained by this SqlCeParameterCollection.<br/>
<br/>
<span style="font-family:Verdana Source Error: <br/>
<br/>
<table width="100%" bgcolor="#ffffcc
<tbody>
<tr>
<td>
Code:
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.
</td>
</tr>
</tbody>
</table>
<br/>
<span style="font-family:Verdana Stack Trace: <br/>
<br/>
<table width="100%" bgcolor="#ffffcc
<tbody>
<tr>
<td>
Code:
<pre>[ArgumentException: The SqlCeParameter with this name is already contained by this SqlCeParameterCollection.]
  System.Data.SqlServerCe.SqlCeParameterCollection.ThrowParamterExistsException() +218
  System.Data.SqlServerCe.SqlCeParameterCollection.AddWithoutEvents(Int32 index, SqlCeParameter value) +98
  System.Data.SqlServerCe.SqlCeParameterCollection.Add(SqlCeParameter value) +47
  System.Data.SqlServerCe.SqlCeParameterCollection.Add(Object value) +86
  System.Web.UI.WebControls.SqlDataSourceView.InitializeParameters(DbCommand command, ParameterCollection parameters, IDictionary exclusionList) +616
  System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +237
  System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +95
  System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1226
  System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +855
  System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95
  System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
  System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +121
  System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
  System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +125
  System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +169
  System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +9
  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
[/code]</td>
</tr>
</tbody>
</table>

<h1>Server Error in /trendtest Application.
<hr size="1
</h1>
The SqlCeParameter with this name is already contained by this SqlCeParameterCollection.



View the full article
 
Back
Top