G
Guest
I have the following lines of VB.Net code. Its works if the HDR property is
set to "No" but changing it to "Yes" generates the error "No Value Given For
One OR More required Parameters". What am I missing?
Dim sInsert, sSelect, sConn, sFile As String
sFile = txtFileName.Text.Trim
sInsert = "INSERT INTO [PassResults] (Model, Result, Operator) "
sSelect = "SELECT F1, F2, F3 from [Excel
8.0;DATABASE=C:\PassResults.xls;HDR=Yes;IMEX=1].[Results$];"
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=TestResults.mdb"
Dim AccessConn As New System.Data.OleDb.OleDbConnection(sConn)
Try
AccessConn.Open()
Dim AccessCommand As New System.Data.OleDb.OleDbCommand(sInsert
& sSelect, AccessConn)
AccessCommand.ExecuteNonQuery()
AccessConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
AccessConn.Close()
End Try
set to "No" but changing it to "Yes" generates the error "No Value Given For
One OR More required Parameters". What am I missing?
Dim sInsert, sSelect, sConn, sFile As String
sFile = txtFileName.Text.Trim
sInsert = "INSERT INTO [PassResults] (Model, Result, Operator) "
sSelect = "SELECT F1, F2, F3 from [Excel
8.0;DATABASE=C:\PassResults.xls;HDR=Yes;IMEX=1].[Results$];"
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=TestResults.mdb"
Dim AccessConn As New System.Data.OleDb.OleDbConnection(sConn)
Try
AccessConn.Open()
Dim AccessCommand As New System.Data.OleDb.OleDbCommand(sInsert
& sSelect, AccessConn)
AccessCommand.ExecuteNonQuery()
AccessConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
AccessConn.Close()
End Try