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