Hello,
I am having a problem with adding a row to my DataSet. I think I know what the problem is, but not how to correct it. I have several bound text boxes that fill from the DataSet. The first column is a numeric and the next several are text strings. When I try to add the new row it hangs at the first entry and gives me a wrong type error. I think the problem is that when it tries to update from the text box with new information, it is trying to enter Text into a Numeric field. My question is how do I convert the data to the proper type during the update? I am including part of the code here for claification. The database is a one table Access database. VID is the Primary Key in the table.
Code:
Private Sub btnAdd_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim drNew As System.Data.DataRow
drNew = Me.DsHeartland1.Customer.NewRow
drNew.Item("VID") = ("New VID")
drNew.Item("Customer Name") = ("New Customer Name")
drNew.Item("Address") = ("New Address")
drNew.Item("City") = ("New City")
drNew.Item("State") = ("New State")
drNew.Item("Zip") = ("New Zip")
drNew.Item("Phone 1") = ("New Phone 1")
drNew.Item("Phone 2") = ("New Phone 2")
drNew.Item("Phone 3") = ("New Phone 3")
drNew.Item("Fax") = ("New Fax")
drNew.Item("Email") = "New Email"
Me.DsHeartland1.Customer.Rows.Add(drNew)
The debugger will stop and error at the line adding "VID" which is a numeric entry.
Any help will be greatly appreciated!