ImLearningDotNet
Member
Hello all, I am trying to add a data row to a data table, but so far I have been unsuccessful. Here is the code I have:
I have a bound combo box on the form, just to check to see if the data is correctly being added to the Sales table. However, I am only receiving a single digit integer after this code runs in the combo box. The integer stored in OrderNumberInteger is 6 digits in length.
Also, I have Copy to Output Directory property set to COpy if Newer. (For the MDF file)
When I run the terminate and then run the program the single digit integer (which is incorrect) that was stored in the combo box is empty.
Note: I have this code at load:
Help would be greatly appreciated.
VB.NET:
Dim newSalesRow As DataRow = MPS_DataSet.Tables("Sales").NewRow()
newSalesRow("invoiceNumber") = OrderNumberInteger.ToString
MPS_DataSet.Tables("Sales").Rows.Add(newSalesRow)
Me.Validate()
Me.SalesBindingSource.EndEdit()
Me.SalesTableAdapter.Update(MPS_DataSet)
I have a bound combo box on the form, just to check to see if the data is correctly being added to the Sales table. However, I am only receiving a single digit integer after this code runs in the combo box. The integer stored in OrderNumberInteger is 6 digits in length.
Also, I have Copy to Output Directory property set to COpy if Newer. (For the MDF file)
When I run the terminate and then run the program the single digit integer (which is incorrect) that was stored in the combo box is empty.
Note: I have this code at load:
VB.NET:
'fills sales tables
Me.SalesTableAdapter.Fill(Me.MusicPlusInventorySQLDataSet.Sales)
'setup sales binding source
With SalesBindingSource
.DataSource = MPS_DataSet
.DataMember = "Sales"
End With
'Bind the InvoiceNumberComboBox to see if working
With Me.InvoiceNumberComboBox
.DataSource = SalesBindingSource
.DisplayMember = "invoiceNumber"
End With
Help would be greatly appreciated.