I keep getting the following error every time i run this script i cannot find any info why this is happening and how to fix it, any help would be great
Dim plmExcelCon As New System.Data.OleDb.OleDbConnection
Dim cmdLoadExcel As System.Data.OleDb.OleDbDataAdapter
Dim PrmPathExcelFile As String
PrmPathExcelFile = txtImportFileLocation.Text.ToString
plmExcelCon = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + PrmPathExcelFile + ";Extended Properties=Excel 12.0;")
cmdLoadExcel = New System.Data.OleDb.OleDbDataAdapter("select * from [" + txtImportSheetName.Text + "$]", plmExcelCon)
Dim ldExcelDS As System.Data.DataSet
ldExcelDS = New System.Data.DataSet
cmdLoadExcel.Fill(ldExcelDS)
plmExcelCon.Close()
'New
Dim dt As DataTable = ldExcelDS.Tables(0)
For Each row As DataRow In dt.rows
Dim impEID As String = row(txtImportEID.Text)
Dim impVID As String = row(txtImportVID.Text)
Try
cmdINSERT.Parameters("@pldLifeDataEID").Value = impEID
cmdINSERT.Parameters("@pldLifeDataVID").Value = impVID
cmdINSERT.Parameters("@pldLifeDataDateEntry").Value = Date.Now
cnLD.Open()
cmdINSERT.ExecuteNonQuery()
cnLD.Close()
Catch ex As Exception
MessageBox.Show(ErrorToString)
End Try
Next
Dim plmExcelCon As New System.Data.OleDb.OleDbConnection
Dim cmdLoadExcel As System.Data.OleDb.OleDbDataAdapter
Dim PrmPathExcelFile As String
PrmPathExcelFile = txtImportFileLocation.Text.ToString
plmExcelCon = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + PrmPathExcelFile + ";Extended Properties=Excel 12.0;")
cmdLoadExcel = New System.Data.OleDb.OleDbDataAdapter("select * from [" + txtImportSheetName.Text + "$]", plmExcelCon)
Dim ldExcelDS As System.Data.DataSet
ldExcelDS = New System.Data.DataSet
cmdLoadExcel.Fill(ldExcelDS)
plmExcelCon.Close()
'New
Dim dt As DataTable = ldExcelDS.Tables(0)
For Each row As DataRow In dt.rows
Dim impEID As String = row(txtImportEID.Text)
Dim impVID As String = row(txtImportVID.Text)
Try
cmdINSERT.Parameters("@pldLifeDataEID").Value = impEID
cmdINSERT.Parameters("@pldLifeDataVID").Value = impVID
cmdINSERT.Parameters("@pldLifeDataDateEntry").Value = Date.Now
cnLD.Open()
cmdINSERT.ExecuteNonQuery()
cnLD.Close()
Catch ex As Exception
MessageBox.Show(ErrorToString)
End Try
Next