Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.
Since then, my project has transitioned to using all bound data tables which originate from Access. One offshoot is that I no longer use just the one datagridview, but have separated the data into a more relational database format (Roster data in one table, Team data in another, etc.).
Private Sub RefreshData() 'Create the connection string to connect to the Microsoft Excel Workbook Dim connectionString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" _ & XL & ";Extended Properties = ""Excel 12.0 Xml;HDR=YES""" 'Create a standard SELECT SQL statement Dim selectStatement As String = _ "SELECT Player_No, Player_Name, SL, Team_ID, Team_No, Team_Name FROM [Roster$]" Dim adapter As New OleDbDataAdapter(selectStatement, connectionString) Dim excelData As New DataTable 'Create a DataAdapter that will be used to populate a DataTable with data Try 'The code to open a connection and execute a statement adapter.Fill(excelData) Catch ex As InvalidOperationException MessageBox.Show(ex.Message) Catch ex As OleDbException MessageBox.Show(ex.Message) Finally 'Any tidy up code here to release resources End Try 'Display the data in the excelDataGridView PlayerDataGrid.DataSource = excelData End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.