RE: ADO.NET DBF update problem - Concurrency violation
From: Brad Roberts (BradRoberts_at_discussions.microsoft.com)
Date: 08/24/04
- Next message: Paul Clement: "Re: reading excel data through vb.net application"
- Previous message: alaspin: "RE: Monolith -> layered client/server?"
- In reply to: Wayne Froese: "ADO.NET DBF update problem - Concurrency violation"
- Next in thread: Wayne Froese: "RE: ADO.NET DBF update problem - Concurrency violation"
- Reply: Wayne Froese: "RE: ADO.NET DBF update problem - Concurrency violation"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 24 Aug 2004 06:33:02 -0700
It is possible that this is a permissions problem in the directory where the
dbf resides. Maybe...
"Wayne Froese" wrote:
> I've had a devil of a time trying to get past an ADO.NET problem. I have to
> deal with DBF files and update them. I've built my own UpdateCommand for my
> Data Adaptor but it doesn't seem to work. I always get a "Concurrency
> violation: the UpdateCommand affected 0 records."
> I've pruned this code down to this basic issue and put it in a button click
> - if you could make this work, I'd be happy:
>
> Dim con As OleDb.OleDbConnection
> Dim daAdaptor As OleDb.OleDbDataAdapter
> Dim dsData As New DataSet
> Dim strDBF As String = "C:\_clients\Canada\ROLLAND INC\NON
> SYNDIQUES\2002-01-01\Data dec2001\cdc.dbf"
> con = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=" & _
> Path.GetDirectoryName(strDBF) & ";Extended Properties=dBASE IV;User
> ID=Admin;Password=")
> daAdaptor = New OleDb.OleDbDataAdapter("Select * FROM " &
> Path.GetFileNameWithoutExtension(strDBF) _
> , con)
> daAdaptor.Fill(dsData)
> daAdaptor.UpdateCommand = New Data.OleDb.OleDbCommand(Nothing, con)
> With daAdaptor.UpdateCommand
> .CommandText = "Update " & Path.GetFileNameWithoutExtension(strDBF)
> & _
> " SET " & "AMT8" & " = @" & "AMT8" & " Where " & _
> "SSN = @SSN"
> .Parameters.Add(New Data.OleDb.OleDbParameter("@SSN",
> Data.OleDb.OleDbType.Char, 11, "SSN"))
> .Parameters.Add(New Data.OleDb.OleDbParameter("@" & "AMT8",
> Data.OleDb.OleDbType.Double, Nothing, "AMT8"))
> End With
> dsData.Tables(0).Rows(0).Item("AMT8") = "100"
> daAdaptor.Update(dsData.Tables(0))
- Next message: Paul Clement: "Re: reading excel data through vb.net application"
- Previous message: alaspin: "RE: Monolith -> layered client/server?"
- In reply to: Wayne Froese: "ADO.NET DBF update problem - Concurrency violation"
- Next in thread: Wayne Froese: "RE: ADO.NET DBF update problem - Concurrency violation"
- Reply: Wayne Froese: "RE: ADO.NET DBF update problem - Concurrency violation"
- Messages sorted by: [ date ] [ thread ]