Hi guys
I have this program that imports and Excel spreadsheet to a database, but when I try and save the imported information, nothing is saved.
Here is my code I have so far….

VB Code:
  1. Private Sub bindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bindingNavigatorSaveItem.Click
  2.         If Me.Validate Then
  3.             Me.StockBindingSource.EndEdit()
  4.             Me.StockTableAdapter.Update(Me.StockDataSet.Stock)
  5.         Else
  6.             System.Windows.Forms.MessageBox.Show(Me, "Validation errors occurred.", "Save", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning)
  7.         End If
  8.     End Sub
  9.  
  10.    Private Sub ImportBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ImportBtn.Click
  11.         Dim DS As System.Data.DataSet
  12.         Dim MyAdapter As System.Data.OleDb.OleDbDataAdapter
  13.         Dim MyConnection As System.Data.OleDb.OleDbConnection
  14.  
  15.         MyConnection = New System.Data.OleDb.OleDbConnection( _
  16.               "provider=Microsoft.Jet.OLEDB.4.0; " & _
  17.               "data source=D:\Stock.XLS; " & _
  18.               "Extended Properties=Excel 8.0;")
  19.         ' Select the data from Sheet1 of the workbook.
  20.  
  21.         MyAdapter = New System.Data.OleDb.OleDbDataAdapter( _
  22.               "select * from [Sheet1$]", MyConnection)
  23.         DS = New System.Data.DataSet()
  24.         MyAdapter.Fill(DS, "StockDataGridView")
  25.         MyConnection.Close()
  26.         StockDataGridView.DataSource = DS.Tables("StockDataGridView") 'Tablegrid Name
  27.     End Sub



Any ideas why this is not saving?

Thanks guys

Nick