gtjr92
Programmer
- May 26, 2004
- 96
I keep getting these 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 below...
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."
I am using asp.net 2.0
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")"
Code:
dsoTithe.UpdateParameters.Item(CInt("@TRidparam") = CInt("@id"))
I am using asp.net 2.0
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>