Blue Theme Orange Theme Green Theme Red Theme
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Home | Forums | Videos | Advertise | Certifications | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
Discover the top 5 tips for understanding .NET Interop
Search :       Advanced Search »
Home » ADO.NET & Database » xBase Engine for C# and VB.NET

xBase Engine for C# and VB.NET

This library is written to handle DBF files from C# or VB.NET applications.

Page Views : 33054
Downloads : 2000
Rating :
 Rate it
Level : Intermediate
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
Download Files:
xBaseEngineRFV.zip
 
 
Nevron Chart
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 

Overview

I've removed the dust to some code that Ive used a while ago for access FoxPro database files (DBFs and Idxs) from C++, in a manner compatible with FoxPro 2.6.

To use DBF files in .NET, I have written a wrapper that allows you to access DBFs directly from C# or VB.NET without using ODBC or ADO.NET.

This library only handles DBFs and normal Idxs. Unfortunately, it doesn't handler memos or Cdxs or compact Idxs.

The library handles shared access over the network using locking and unlocking mechanism. Some other features of the library are database table creation, cursor creation, index creation or recreation and so on. 

To use this library, you can unzip attached xBaseEngineRFV.zip into a working directory, open db solution under Visual Studio and Build Solution. This solution includes 2 projects:

  1. The engine DLL project, that make db.dll that you can add to any C# or VB.NET project.
  2. A test program written in C#. This program uses some of the functionality of the engine. 

Description

It is complicated to build a DBF engine without the services of expression evaluator, internal functions, memory variable manager and so on. But this engine gives you all tools that you would need for utilizing DBF files on the network. 

The best way to learn and use the engine is look at the example code that ships with this solution. In resume, you cant:

  1. Construct one or more objects based on xdbf class. At this time, the object not represent any database, is only a container.
  2. Open a database. You can open an existing dbf (utilizing .Use() method), or create a new one (using CreaTable() or CreaCursor() methods).
  3. If you need, attach existing indexes (using SetIndex() methods) or create new ones (using IndexOn() methods).
  4. Manipulate databases. You can add new records (using AppendBlank() method), get field data (using Get() method) or replace data (using Replace() method). You can test for end of file condition (using Eof property) or begin of file condition (using Bof property). You can delete records (using Delete() method), or know the count of records (using RecCount property) or the deleted status of a record (using Delete property).
  5. Navigate through database, utilizing sequential search (using Locate() method), indexed search (using SetOrder() and/or Seek() methods), absolute positioning (using Go() method) or relative positioning (using Skip() method).
  6. If you are utilizing shared databases, you can lock or unlock records (using Lock() method). Engine perform automatic locking before replace, with auto refresh of record information.
  7. You can set relations between open databases (using SetRelation()).
  8. Close databases. The close is performed automatically when the container object is destroyed. 

There are more methods and properties available. Some of the methods you can use to utilize to request fields types, fields sizes and so on. Try it!!!

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
Ricardo Federico
My name is Ricardo Federico Villafañes, I’m Electronic Engineer and live in Argentina. I start coding near 1990, and I've utilized basic, c, c++, fox languages. I’ve started C# 4 month ago. Actually, I’m working for a chain of supermarkets.
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Discover the Top 5 .NET Memory Management Fundamentals
To write the best .NET code, you need to know exactly how the .NET framework really manages memory. Ricky Leeks presents the Top 5 fundamental facts of .NET memory management. Learn more.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
 Comments
xBase Engine for C# by Carlos On April 24, 2009
Hola Federico ! Estoy utilizando la clase que nos has dejado por aquí y me encontré con un problema en un archivo dbf. Aparentemente no lo abre porque tiene un campo memo. ¿ Puede ser esto ? ¿ Se puede usar la clase con archivos indices .NTX ? Si puedes ver el archivo dbf te lo mando. Muchas gracias. Carlos Pizzi carlos.pizzi@gmail.com
Reply | Email | Modify 
can't load db by Mohamad On May 5, 2009

Hello. Thank you for xBase Engine.

Actually I have question on how to utilize this library. I'm using visual studio 2008 C # for my project and I'm dealing with Dbf file from time portal software. I already downloaded xBaseEngineRFV.zip and installed it in my pc. When I tried to open db.sln the system couldn't load db.vcproj because its project type is not supportted by this version. What should I do? Thank you.

my email mabojon69@gmail.com

Reply | Email | Modify 
No logro descargar el .zip by antonio On May 19, 2009
Hola Federico, Soy profesor de la universidad de la Habana y necesito editar un .dbf. La clase que tu programaste pienso que me podría ser útil, desgraciadamente no logro descargarlo, aquí la Internet es lentísima y tengo problemas hasta para registrarme. Si pudieses mandarme el fichero a mi dirección de correo te lo agradecería un mundo: bolufé@matcom.uh.cu , gracias, Antonio Bolufé.
Reply | Email | Modify 
problem with index by Domi On November 15, 2011
Hi, thanks for the code, I don't know if you always follow this thread but there is a bug with indexes, I have a database, index on one field and the application loops around without stopping ... if you want I can send you all the material necessary to reproduce the problem, just send me an email to d.hugo@skynet.be thanks in advance, sincerly, Domi
Reply | Email | Modify 

 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.