Accessing Clipper dBase(dbf) file from .Net RRS feed

  • Question


    Hi Friends

    I  connected to Clipper database and trying to access the table in it. I could able to read all the columns of the table except one column which has length of 500 char...

    Doubt: How to access the table column which has length more than 250 char...(ie) 500 char

    I have use both oledb and odbc

    oledb Connection String :

    string ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\PathofDBfFile;Extended Properties=dBASE III;";

    Odbc Connection String :

    string ConnectionString = @"Driver={Microsoft dBASE Driver dbf)};DriverID=276;Dbq=E:\PathOfDbfFile";

    Thanks In Advance


    Wednesday, March 7, 2007 1:16 PM

All replies

  • I've not dealt with a Clipper database before but when using Jet OLEDB, columns containing more than 255 characters are considered memo fields and require a different method to access the data. Give the following a try and see if it works for you (just change the connection string, column names, etc.):

    Dim retVal As Long

    Dim FieldLen As Int32

    Dim MemoCol As Integer = 1 ' the column # of the Memo field in the query

    Dim AccessConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _

    "Data Source=e:\My Documents\db1.mdb")

    Dim AccessCommand As New OleDbCommand("SELECT [record ID], MemoField FROM Table1 WHERE [record id] = 1", AccessConnection)


    Dim dr As OleDbDataReader = AccessCommand.ExecuteReader(CommandBehavior.SequentialAccess)


    FieldLen = dr.Item(MemoCol).Length

    Dim MemoBuffer(FieldLen - 1) As Char

    Dim startIndex As Integer = 0

    retVal = dr.GetChars(1, startIndex, MemoBuffer, 0, MemoBuffer.Length)




    Wednesday, March 7, 2007 2:58 PM

    Thanks for your reply...........

    i tried paul......iam get only null value for the column of more than 255......(ie) FieldLength count is zero

    any way thanks for your help.........

    good snippet that i can add to my library and reference later.........




    Thursday, March 8, 2007 6:07 AM

  • About the only other suggestion I can offer is to try the Visual FoxPro OLEDB Provider.
    Thursday, March 8, 2007 1:04 PM