OLEDB data source / connector String error

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Im having trouble getting a ole db connection to a early dbf (dbase IV). As per the code below Im attempting to connect to a dbf data source in a "c:test" folder.
The problem seems to be my connection string breaks at the "" in the data source location
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c: est ;Extended Properties=dBASE IV;"

It does this for any folder.
Any help or ideas would be appreciated. Thanks

<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; using System;
<span style="color:Blue; using System.Collections.Generic;
<span style="color:Blue; using System.Linq;
<span style="color:Blue; using System.Text;

<span style="color:Blue; using System.Data.OleDb;

<span style="color:Blue; namespace ConsoleApplication
{
<span style="color:Blue; class Program
{
<span style="color:Blue; static <span style="color:Blue; void Main(<span style="color:Blue; string[] args)
{


OleDbConnection myConnection = <span style="color:Blue; new OleDbConnection();
myConnection.ConnectionString = <span style="color:#A31515; "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:test;Extended Properties=dBASE IV;";


<span style="color:Blue; try
{
myConnection.Open();
Console.WriteLine(<span style="color:#A31515; "ServerVersion: {0} nDataSource: {1}",
myConnection.ServerVersion, myConnection.DataSource);
}
<span style="color:Blue; catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

}

}
}
[/code]




View the full article
 
Back
Top