rmmarsh
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:
Can someone please tell me what the connection string is supposed to look like?
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;
}
Can someone please tell me what the connection string is supposed to look like?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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()).
ASKER
Here's the correct answer:
Provider=Microsoft.Jet.OLE DB.4.0;Dat aSource=C: \Prager\Ex port\dgvEx portData.t xt; Extended Properties='text;HDR=Yes'
Notice the single quotes in Properties?
Thanks for your help anyway...
Provider=Microsoft.Jet.OLE
Notice the single quotes in Properties?
Thanks for your help anyway...
ASKER
Thanks again...
http://www.codeproject.com/KB/vb/DataGridView_and_CSV.aspx
http://www.youtube.com/watch?v=jjQZT4zbs_E