Unable to find installable isam c # Read VFP data

Source: Internet
Author: User

When I saw a question about C # Reading VFP data, I tried to solve it. I was a little impressed, so I wrote a code test;

Install oledb provider of VFPOledb and download it from Microsoft;

After the installation is complete, the routine database Northwind based on this Provider is tested with the following code:

Reprinted Please note: http://www.cnblogs.com/winzheng/archive/2009/07/11/1521435.html

1 public void OpenVFP ()
2 {
3 OleDbConnection objConn = new OleDbConnection ();
4 OleDbDataAdapter SQLada;
5 objConn. ConnectionString = @ "Provider = Microsoft. Jet. OLEDB.4.0;" +
6 "DataSource = C: \ VFP \ Samples \ Northwind;" + // This is the path for local Provider Installation
7 "Extended Properties = 'dbase 5.0 '";
8 objConn. Open ();
9 OleDbCommand cmd = new OleDbCommand ();
10 cmd. CommandType = CommandType. Text;
11 cmd. CommandText =
12 "select * from employeeterritories"; // employeeterrITories. dbf
13 SQLada = new OleDbDataAdapter (cmd );
14}

Run the program: No installable ISAM is found;

Haha, never met, search ......

DataSource = C: \ VFP \ Samples \ Northwind; Data Source = C: \ VFP \ Samples \ Northwind;

Eat the space. In short, you cannot write an error in your connection string. Otherwise, this error will be reported.

A similar problem may occur in the following situations. For example, if you set "Excel 12.0; HDR = Yes; IMEX = 1", you will also get this result if the quotation marks are missing:

OleDbConnection cn = new OleDbConnection (@ "Provider = Microsoft. jet. OLEDB.4.0; Data Source = D: \ upload \ 2009070512123000005.xls; Extended Properties = 'excel 12.0; HDR = Yes; IMEX = 1 ';");

It is recommended that you make the commonly used connections into a template, not only in mind, it is best to paste it directly when you use it, otherwise small negligence will lead to large losses.

Reprinted please indicate original location: http://www.cnblogs.com/winzheng/archive/2009/07/11/1521435.html

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.