Hello everone.
Can somebody help me?
When I run my code I can read, write to and delete from database, but when I
have done one of these things and try to copy the databasefile from my
folder to an other folder with Windows Explorer the system "hangs up" for a
couple of minutes. It seems like the databasefile is not closed. But after
2 - 3 minutes the system recover, and I can copy the file without any system
"hangups".
This is a problem because when I try to write to or delete from the database
with my program, it seems like the program also "hangs up" and I must wait
2 - 3 minutes till it recover again. Then the changes is stored.
This is the code I use when I try to write to the database:
Dim sSQL As String
Dim connection As String
connection = "provider=Micro soft.JET.OLEDB. 4.0;Data
Source=J:\Besti lling.mdb"
sSQL = "INSERT INTO Bestillinger (StudentNummer, DatamaskinType, LeieTid)
VALUES ('" & studentNr & "', '" & typeMaskin & "', '" & leiePeriode & "')"
Dim testConn As New System.Data.Ole Db.OleDbConnect ion(connection)
Dim testCmd As New System.Data.Ole Db.OleDbCommand (sSQL, testConn)
Try
testConn.Open()
Catch myExceptions As System.Exceptio n
Console.WriteLi ne(myExceptions .Message)
End Try
Console.Write(" Test", sSQL)
Console.ReadLin e()
If testConn.State = ConnectionState .Open Then
Try
testCmd.Execute NonQuery()
Catch myExceptions As System.Exceptio n
Console.WriteLi ne(myExceptions .Message)
Console.ReadLin e()
End Try
testConn.Close( )
End If