Link to home
Start Free TrialLog in
Avatar of rmmarsh
rmmarshFlag for United States of America

asked on

Format of the initialization string does not conform to specification starting at index 114?

I am the first to admit I don't know what I'm doing with this (I have NEVER used OleDB).  I'm trying to take a CSV file and import it into an existing DataGridView.  This is the code I have copied and modified:
 
 
public void restoreSavedEntries() {

        string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=" +
            @"D:\Export\dgvExportData.txt\;" +
            "Extended Properties=\"Text;HDR=YES;\"";

        OdbcConnection conn = new OdbcConnection(strConn);
        OdbcDataAdapter da = new OdbcDataAdapter("Select ISBN,SKU from dgvExportData.txt", conn);
        DataTable dt = new DataTable();
        da.Fill(dt);
        dgvDataEntry.DataSource = dt;

        }

Open in new window


Can someone please tell me what the connection string is supposed to look like?
Avatar of Anil Golamari
Anil Golamari
Flag of United States of America image

ASKER CERTIFIED SOLUTION
Avatar of Anil Golamari
Anil Golamari
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rmmarsh

ASKER

I tried changing my connection string to match yours and got the same error... in addition, I can't see any way to "bind" the dataset (ds) to the datagridview (there is NO .Bind()).
Avatar of rmmarsh

ASKER

Here's the correct answer:

Provider=Microsoft.Jet.OLEDB.4.0;DataSource=C:\Prager\Export\dgvExportData.txt; Extended Properties='text;HDR=Yes'

Notice the single quotes in Properties?

Thanks for your help anyway...
Avatar of rmmarsh

ASKER

Thanks again...