I'm updating a .dbf table in VB.NET using the Microsoft.Jet.OLEDB.4.0 provider. I'm not sure if it's a FoxPro .DBF, or another "flavor" of .DBF, but the code I "inherited" (don't you love those?) uses "Extended Properties='DBASE IV'" in the connection string.
My question is, are transactions supported in this situation? My preliminary testing seems to indicate not, but I want to check with the experts before I come to any rash conclusions. :) Here's my test code. After running, ei_sent is still 1. The Rollback didn't roll back. This same code with the sqloledb provider works perfectly. After running, ei_sent is still 0. Am I doing something wrong, or are transactions just not suppoerted with Jet? Or is there another way I should handle transactions with Jet and/or a .DBF database?
Imports System.Data
Imports System.Data.OleDb
Module Module1
Public Sub Main()
Dim ConnectionString As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\softphrm\data;" & _
"Extended Properties='DBASE IV';"
Dim sql As String = _
"UPDATE qn_ei " & _
" SET ei_sent=1 " & _
" WHERE ei_sent=0"
Dim cnn As New OleDbConnection(ConnectionString)
Dim trn As OleDbTransaction
cnn.Open()
trn = cnn.BeginTransaction()
Dim cmd As New OleDbCommand(sql, cnn)
cmd.Transaction = trn
cmd.ExecuteNonQuery()
trn.Rollback()
cnn.Close()
End Sub
End Module
-----
Lee Perkins
-----
Lee Perkins
TigerBase Technologies
"Lee is one that would plug his brain into the internet, if he could, and STILL scream for more" - Very good friend of Lee's