I have an asp.net website that needs to connect to a dBase file on a remote server. The remote server has a ODBC System DSN connection configured but I have no idea how to connect to it.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The ODBC connection on the server won’t help you. The ODBC Connection needs to be set up on the machine you want to connect FROM, not the one you want to connect TO.
In order to connect to the DBASE files (and treat them like a database) you will need to
It ALSO deals with a problem you will have reading DBase files from .NET. If you read them often enough, the app will start throwing a “System.Resources.Exceeded” exception. The only reliable solution I’ve found has been to kill the app and restart it, which is done in the code named FixMyself. (Not included as it contains sensitive data). The FixMyself routine essentially starts a second exe that kills THIS exe and then restarts it.
The sample code below is copied from production code, and should give you a push int he right direction. it maps the drive, connects, and reads.
It’s ugly but it works. It’s also only partial as it calls several functions not included here. But again, it should be enough to get you going.