I am using asp.net 2.0 I keep getting the below errors I have a sub that looks at my gridview and then is supposed to update my database with the parameters below but I get these errors ...
Value of type 'Decimal' cannot be converted to 'System.Web.UI.WebControls.Parameter'.
for this line
If I try iy this way
Then I get "Property access must assign to the property or use its value."
HEre is the rest of my code for this
Value of type 'Decimal' cannot be converted to 'System.Web.UI.WebControls.Parameter'.
for this line
Code:
"dsoTithe.UpdateParameters.Item("@Titheparam") = CDec("@Titheup")"
If I try iy this way
Code:
dsoTithe.UpdateParameters.Item(CInt("@TRidparam") = CInt("@id"))
HEre is the rest of my code for this
Code:
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 Int32 = (GridView1.DataKeys(dgi.RowIndex).Value.ToString())
Dim Titheup As Decimal = CType(dgi.FindControl("TxtTithe"), TextBox).Text
dsoTithe.UpdateParameters.Item("@Titheparam") = CDec("@Titheup")
dsoTithe.UpdateParameters.Item(CInt("@TRidparam") = CInt("@id"))
dsoTithe.UpdateParameters.Clear()
dsoTithe.Update()
Next
End Sub
Code:
<asp:AccessDataSource ID="dsoTithe" runat="server" DataFile="~/App_Data/tithe/GBCTITHE.MDB"
SelectCommand="SELECT [Weeks_Date], [People_ID], [Name], [Tithe], [Education], [Missions], [Special], [Gift_Item], [Gift_Value], [WkID], [TRID] FROM [TblCombine] WHERE ([WkID] = ?)"
UpdateCommand="UPDATE [Tithe] SET [Tithe]=? Where [trid]=?">
<UpdateParameters>
<asp:Parameter Name="Titheparam" Type="Decimal" />
<asp:Parameter Name="Tridparam" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="lbxWeeks" DefaultValue="1" Name="WkID" PropertyName="SelectedValue"
Type="Double" />
</SelectParameters>
</asp:AccessDataSource>