update dbase (dbf) tables

R

Robert Bravery

HI all,

Can someone show me or point me to a place where I can find out how to
update dbase(dbf) tables.

Thanks
RObert
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

You can use ODBC, I do not remember if you can use OLEDB, go to
connectionstrings.com and see what options you have.


--
Ignacio Machin
machin AT laceupsolutions com


| HI all,
|
| Can someone show me or point me to a place where I can find out how to
| update dbase(dbf) tables.
|
| Thanks
| RObert
|
|
 
M

Michael Nemtsev

Hello Robert,

Just to add to Mark's post the native dbf access is realized in CodeBase lib

RB> Can someone show me or point me to a place where I can find out how
RB> to update dbase(dbf) tables.

---
WBR, Michael Nemtsev [C# MVP]. Blog: http://spaces.live.com/laflour
team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
 
C

Cindy Winegarden

Hi Robert,

Depending on whether the dbase files are compatible, you might try the
FoxPro and Visual FoxPro OLE DB data provider, downloadable from the link
under my signature.

Here's some VB.NET code to get you started. You should be able to translate
it to C#:


Imports System
Imports System.Data
Imports System.Data.OleDb

Module Module1

Sub Main()

Try

Dim cn1 As New OleDbConnection( _
"Provider=VFPOLEDB.1;Data Source=C:\Temp\;")
cn1.Open()

Dim cmd1 As New OleDbCommand( _
"Create Table Test (Field1 I, Field2 C(10), Field3 L)", cn1)
cmd1.ExecuteNonQuery()

' In VFP logical values are represented in text as .F. and .T.
Dim cmd2 As New OleDbCommand( _
"Insert Into Test Values (1, 'Row 1', .T.)", cn1)
cmd2.ExecuteNonQuery()

Dim cmd3 As New OleDbCommand( _
"Insert Into Test Values (2, 'Row 2', .F.)", cn1)
cmd3.ExecuteNonQuery()

Dim da1 As New OleDbDataAdapter("Select * From Test", cn1)
Dim ds1 As New DataSet()
da1.Fill(ds1)

'Dim dr1 As DataRow()
'ds1.Tables(0).Rows.Add(dr1)
'ds1.Tables(0).Rows(2).Item(0).
Console.WriteLine(ds1.Tables(0).Rows(0).Item(2).ToString())
Console.WriteLine(ds1.Tables(0).Rows(1).Item(2).ToString())
Console.ReadLine()

Catch e As Exception
MsgBox(e.ToString())
End Try

End Sub

End Module



--
Cindy Winegarden
(e-mail address removed)

VFP OLE DB: http://msdn2.microsoft.com/en-us/vfoxpro/bb190232.aspx
VFP ODBC: http://msdn2.microsoft.com/en-us/vfoxpro/bb190233.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top