Operations of ASP on FoxPro free table (DBF file)

Source: Internet
Author: User
I. Question proposal
In a recent project, I encountered an ASP operation problem on the FoxPro database table (*. DBF. In reality, many applications use the DBF table and how to use the data in the network environment makes many friends unable to do anything.
I also checked a lot of information and did not find a detailed description of the solution. After testing, we have initially solved this problem and shared it with you.
This article attempts to solve the following problems:
1. ASP joins the free table generated by FoxPro (*. dbf file)
2. Save multiple types of data and graphic files to the dbf table at the same time.
(The sample program can be obtained from http://www.netop.cc/downloads/dbf.rar)
II. Environment
Windows2000 + IIS5.0 + IE6.0 (SP1)
The DBF file is a free table generated by Microsoft Visual FoxPro 6.0 (non-dbc database)
III. Solution
1. Connection
The ODBC Driver of the DBF file is named Microsoft Visual FoxPro Driver. In ASP, it is connected to it through the Connection object. Note that the directory where DBF is located is considered as the database name during Connection. The specific connection code is as follows:
DIM conn, connstr, db
Db = "data"
Set conn = Server. CreateObject ("ADODB. Connection ")
Connstr = "Driver = {Microsoft Visual FoxPro Driver}; SourceType = DBF ;"&_
"SourceDB =" & Server. MapPath (db) & "; Exclusive = No"
Conn. Open connstr
In the above code, data is the relative path (relative to the file where the code is located) of my DBF file, and is converted to an absolute path through Server. MapPath (db.
The http://www.connectionstrings.com provides many types of database table file connection strings, where for the DBF file, the given connection strings are:
"Driver = {Microsoft dBASE Driver (*. dbf)}; DriverID = 277; Dbq = c: mydbpath ;"
The connection string I used was not successfully connected and I did not perform further tests. If you are interested, try the above strings.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.