|
|
Friday, May 23, 2003 |
|
Back in February I wrote about my struggles accessing some very old (circa 1995) FoxPro tables with memo fields using .NET. At the time I gave up, purchased DBFView to export the FoxPro, and imported everything into a SQL Server database (using MSDE). Richard Brown just wrote to let me know that he got everything working and provided a code example. I am pretty sure I tried this already, but will give it another go this weekend. Here is Richard's code (modified to fit this column):
Dim strConn, strSQL As String
strConn =
"Driver={Microsoft FoxPro VFP Driver (*.dbf)};
SourceDB=directoryName;
SourceType=DBF;"
strSQL =
"select CN_REF from
a_cname WHERE CN_CATAG = 'ALL'"
Dim da As New OdbcDataAdapter(strSQL, strConn)
Dim cb As New OdbcCommandBuilder(da)
Dim tbl As New DataTable()
da.Fill(tbl)
Dim row As DataRow = tbl.Rows(0)
Dim strOrigValue As String = row("CN_REF")
Dim intcounter As Integer
Dim strresult As String
With tbl
For intCounter = 0 To .Rows.Count - 1
strresult =
.Rows(intcounter).Item("CN_REF") &
" " &
.Rows(intCounter).Item("CN_DESC")
Console.WriteLine(strResult)
Next
End With
10:39:13 AM |
|
Larry O'Brien has put together a short, straight-forward, and informative tutorial on using .NET's System.Configuration namespace to manage application configuration.[Thinking In .NET] 9:19:25 AM |
