Thanks jmcilhinney & cjard,
I am rather new and I am still having some difficulties. Would my Insert command be querying the data from the dataset or the excel spreadsheet? How would I program the dataadapter know to write the datagrid dataset to sqldatabase? That is what's confusing me the most.
OptionStrictOn
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.IO
PublicClass frmImport
Inherits System.Windows.Forms.Form
PrivateSub frmImport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
'Me.LoadOrders()
EndSub
PrivateSub btnImport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnImport.Click
Me.LoadOrders()
EndSub
PrivateSub LoadOrders()
Dim sConnectionString AsString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\GiftCardImport;Extended Properties=Text;"
Dim conImport AsNew OleDbConnection(sConnectionString)
conImport.Open()
Dim importCmdSelect AsNew OleDbCommand("Select * from PendingTransactionList.csv", conImport)
Dim dbImport AsNew OleDbDataAdapter()
dbImport.SelectCommand = importCmdSelect
Dim dsImport AsNew DataSet()
dbImport.Fill(dsImport, "PendingTransactionList")
grdImport.DataSource = dsImport.Tables(0).DefaultView
dbImport.AcceptChangesDuringFill = False
EndSub
EndClass