Does anybody know how to add a checked radio button item in VB.NET 2003 to a database in MS Access?
CODE
Private Sub mnuOrderAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuOrderAdd.Click
'copy new data to global variables.
newCustID = lblCustID.Text
newWholesale = rdWholesale.Checked
newDesigner = rdDesigner.Checked
newRetail = rdRetail.Checked
newShow = txtShow.Text
newSubtotal = lblSubtotal.Text
newDiscount = lblDiscount.Text
newShipping = lblShippingTotal.Text
newTotal = lblTotal.Text
'Signal add was clicked and add to record
Me.DialogResult = DialogResult.OK
If Me.DialogResult = DialogResult.OK Then
AddNewOrder()
End If
End Sub
Private Sub AddNewOrder()
Dim newDataRow As System.Data.DataRow
newDataRow = DsOrder1.tblOrder.NewRow
newDataRow.Item("fldPhoneNumber") = newCustID
newDataRow.Item("fldShow") = newShow
newDataRow.Item("fldDesigner") = newDesigner
newDataRow.Item("fldWholesale") = newWholesale
newDataRow.Item("fldRetail") = newRetail
newDataRow.Item("fldShipping") = newShipping
newDataRow.Item("fldSubtotal") = newSubtotal
newDataRow.Item("fldTotal") = newTotal
newDataRow.Item("fldDiscount") = newDiscount
'add the new row to the dataset
DsOrder1.tblOrder.Rows.Add(newDataRow)
'update the database file
daOrder.Update(DsOrder1)
End Sub
when the program is run and I try to add to the database with one of the radio buttons checked it give back this error: An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll
Additional information: System.FormatException: Input string was not in a correct format.
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s, NumberStyles style, IFormatProvider provider)
at System.Convert.ToInt32(String value, IFormatProvider provider)
at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Convert.ToInt32(Object value)
at System.Data.Common.Int32Storage.Set(Int32 record, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't store <True> in fldDesigner Column. Expected type is Int32.
Anybody know what needs to be done to fix this?
Thanks in advance.