Format of the initialization string does not conform to specification...

G

gloria

I am trying to load data from a flatfile into a dataset, but I get the
following errror: "Couldn't connect: Format of the initialization
string does not conform to specification starting at index 170."

What am I doing wrong?

--gloria

--------------------------
schema.ini:
[861D_NI_03082005001.txt]
ColNameHeader=False
Format=TabDelimited
CharacterSet=ANSI
--------------------------
string filename = "861D_NI_03082005001.txt";
string fullfilename = @"\\asean-test2\sdc\" + filename;

string connectionStr = "Provider=MediaCatalogMergedDB OLE DB Provider;"
+
"Persist Security Info=False;Data Source=" + fullfilename +
";Mode=Read" +
"Extended Properties=\"Text;HDR=NO;\"";


string loaddtlStr = "select * from " + filename;

try
{
OleDbConnection loaddtlCN = new OleDbConnection(connectionStr);
loaddtlCN.Open();
porerrorClass.WriteLine(3,CurrentFunction,"Connection is open.");

OleDbDataAdapter loaddtlDA = new
OleDbDataAdapter(loaddtlStr,loaddtlCN);
DataSet loaddtlDS = new DataSet("LoadedDtl");
loaddtlDA.Fill(loaddtlDS);

int rowcnt = loaddtlDS.Tables[0].Rows.Count;

porerrorClass.WriteLine(3,CurrentFunction,"Rows loaded: " + rowcnt);

loaddtlCN.Close();
}
catch (Exception ex)
{
porerrorClass.WriteLine(3,CurrentFunction,"Couldn't connect: " +
ex.Message);
}
 
V

Val Mazur \(MVP\)

Hi,

Do you get this error when you open connection? If yes, Have you tried to
use Jet 4.0 OLEDB provider?
If it is during selection of the data it is possible that provider cannot
predict proper number of the columns it needs to create for the result and
it fails.
 
G

gloria

Investigation has shown that I don't have Microsoft.Jet.40.OLEDB as a
valid provider. Jet comes with Access, which I don't have a license
for. I will look into getting this.

Thanks for your help!

--gloria
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top