G
Guest
I'm using oledb to read an excel data and create a formate file to send to
another app.
DataSource = DataDir & xlsFile
Dim xlPNSCon1 As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & DataSource & " ;" & _
"Extended Properties=""Excel 8.0; HDR=no;
MaxScanRows=1; IMEX=1"""
Dim conn1 As New OleDbConnection(xlPNSCon1)
Dim cmd1 As New OleDbCommand _
("Select * From [" & workSheet & "] where len(trim(F41)) >
0 and IsNumeric(F2) = True " & _
" and trim(F5) <> 'DEPT' order by F2,F4 ", conn1)
Dim rdr As OleDbDataReader = cmd1.ExecuteReader
rdr.close
File.Move(oldfile,newfile) <=== get ystem.IO.IOException: The process
cannot access the file ...... because it is being used by another process.
I assume it is in use by this process but is there a way to dallocate it so
it could be moved?
another app.
DataSource = DataDir & xlsFile
Dim xlPNSCon1 As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & DataSource & " ;" & _
"Extended Properties=""Excel 8.0; HDR=no;
MaxScanRows=1; IMEX=1"""
Dim conn1 As New OleDbConnection(xlPNSCon1)
Dim cmd1 As New OleDbCommand _
("Select * From [" & workSheet & "] where len(trim(F41)) >
0 and IsNumeric(F2) = True " & _
" and trim(F5) <> 'DEPT' order by F2,F4 ", conn1)
Dim rdr As OleDbDataReader = cmd1.ExecuteReader
rdr.close
File.Move(oldfile,newfile) <=== get ystem.IO.IOException: The process
cannot access the file ...... because it is being used by another process.
I assume it is in use by this process but is there a way to dallocate it so
it could be moved?