You are on page 1of 1

' this code opens writes the CofA Ingredient and Results found named ranges to the datagrid

for the user to update.

connect = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet. OLEDB.4.0;" & "data source=" & BookToWorkOn & ";Extended Properties=Excel 8.0;") connect.Open() ' Puts the ingredient column from Named Range [Ingredient} in adapter = New System.Data.OleDb.OleDbDataAdapter("select * From [Ingredi ent]", connect) adapter.Fill(dataset) Me.DataGridView1.DataSource = dataset.Tables(0) connect = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet. OLEDB.4.0;" & "data source=" & BookToWorkOn & ";Extended Properties=Excel 8.0;") 'Adds the column data from the Named Range [Found] in adapter = New System.Data.OleDb.OleDbDataAdapter("select * from [Found]" , connect) adapter.Fill(dataset) Me.DataGridView1.DataSource = dataset.Tables(0) connect.Close()

You might also like