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);
}
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);
}