gtjr92
05-09-2005, 05:49 AM
I am trying to create a SUB in asp.net 2.0that will eventually update a fully editable grideview. However when i try this i get a no value for parameters error on this line dsoTithe.Update()
Sub Updatedb(ByVal sender As Object, ByVal e As EventArgs)
Dim dgi As GridViewRow
For Each dgi In GridView1.Rows
'Read in the Primary Key Field
Dim id As Integer = (GridView1.DataKeys(dgi.RowIndex).Value.ToString() )
Dim Titheup As Double = CType(dgi.FindControl("TxtTithe"), TextBox).Text
'Call UPDATE statement...
dsoTithe.UpdateParameters.Clear()
dsoTithe.Update()
Next
End Sub
<asp:AccessDataSource ID="dsoTithe" runat="server" DataFile="~/App_Data/tithe/GBCTITHE.MDB"
UpdateCommand="UPDATE Tithe SET Tithe=? Where trid=?">
<updateparameters>
<asp:controlparameter name="Titheparam" controlid="Updatedb" propertyname="Titheup"/>
<asp:controlparameter name="TRIdparam" controlid="Updatedb" propertyname="id"/> </updateparameters>
</asp:AccessDataSource>
[quote]Here is the full error</CODE>
System.Data.OleDb.OleDbException was unhandled by user code
ErrorCode=-2147217904
Message="No value given for one or more required parameters."
Source="Microsoft JET Database Engine"
StackTrace:
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at System.Web.UI.WebControls.SqlDataSourceView.Execut eDbCommand(DbCommand command, DataSourceOperation operation) at System.Web.UI.WebControls.SqlDataSourceView.Execut eUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) at System.Web.UI.WebControls.SqlDataSourceView.Update (IDictionary keys, IDictionary values, IDictionary oldValues) at System.Web.UI.WebControls.SqlDataSource.Update() at _Default.Updatedb(Object sender, EventArgs e) in H:\ASPNET20\WebSites\GBCTithe\Default.aspx.vb:line 66 at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Sub Updatedb(ByVal sender As Object, ByVal e As EventArgs)
Dim dgi As GridViewRow
For Each dgi In GridView1.Rows
'Read in the Primary Key Field
Dim id As Integer = (GridView1.DataKeys(dgi.RowIndex).Value.ToString() )
Dim Titheup As Double = CType(dgi.FindControl("TxtTithe"), TextBox).Text
'Call UPDATE statement...
dsoTithe.UpdateParameters.Clear()
dsoTithe.Update()
Next
End Sub
<asp:AccessDataSource ID="dsoTithe" runat="server" DataFile="~/App_Data/tithe/GBCTITHE.MDB"
UpdateCommand="UPDATE Tithe SET Tithe=? Where trid=?">
<updateparameters>
<asp:controlparameter name="Titheparam" controlid="Updatedb" propertyname="Titheup"/>
<asp:controlparameter name="TRIdparam" controlid="Updatedb" propertyname="id"/> </updateparameters>
</asp:AccessDataSource>
[quote]Here is the full error</CODE>
System.Data.OleDb.OleDbException was unhandled by user code
ErrorCode=-2147217904
Message="No value given for one or more required parameters."
Source="Microsoft JET Database Engine"
StackTrace:
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at System.Web.UI.WebControls.SqlDataSourceView.Execut eDbCommand(DbCommand command, DataSourceOperation operation) at System.Web.UI.WebControls.SqlDataSourceView.Execut eUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) at System.Web.UI.WebControls.SqlDataSourceView.Update (IDictionary keys, IDictionary values, IDictionary oldValues) at System.Web.UI.WebControls.SqlDataSource.Update() at _Default.Updatedb(Object sender, EventArgs e) in H:\ASPNET20\WebSites\GBCTithe\Default.aspx.vb:line 66 at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)