T
tbuffaloe
I have a very confusing situation. An MDB with 530 tables The last
table added has 97 fields defined, 93 text fields of varying lengths,
3 number fields, 1 memo field.
With a machine with office 2003 this MDB opens correctly and
referencing the tables functions completely normally.
The same file (or a copy) placed on a machine with office 2007 returns
the error message when the specific table is referenced.
Copy back to the orignal machine and the access 2003 can access the
tables without issue.
Help!!!.
I have also created a VS.NET application to read the tables out of the
MDB, and the utility has the same results.
Below is the code snippet identifying where the error occurs. On a
machine with office 2003 this code functions normally and without
error, on a machine with office 2007 the error actually starts when
trying to read the schema from the MDB file.
using System;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Globalization;
....
public class DataExportObj
{
private OleDbConnection m_connGeneric;
private string m_strExePath;
static public string m_sSepChar = "|";
/// <summary>
/// DataExportObj - Constructor.
/// </summary>
/// <param name="oDS"> Output dataset</param>
/// <param name="strTableName"> Database table name</param>
public DataExportObj(ref DataSet oDS, string strTableName)
{
//
// Identify where the program was run from to find the export
reference database.
//
string codebasefile =
System.Reflection.Assembly.GetExecutingAssembly().Location;
m_strExePath = Path.GetDirectoryName(codebasefile);
m_strExePath = Path.Combine(m_strExePath, "CSVDef.mdb");
m_connGeneric = new OleDbConnection();
m_connGeneric.ConnectionString = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDBatabase Locking Mode=1;Data
Source="
+ m_strExePath + ";Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
Transactions=1;Provider=\"Microsoft.Jet.OLEDB.4.0\";Jet
OLEDB:SFP=False;Mode=Share Deny None;Jet OLEDB:Create System
Database=False;Jet OLEDBon't Copy Locale on Compact=False;Jet
OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet
OLEDB:Encrypt Database=False";
m_connGeneric.Open();
AddTable(ref oDS, strTableName);
}
/// <summary>
/// AddTable - Add a table to the existing dataset.
/// </summary>
/// <param name="oDS"> Output dataset</param>
/// <param name="strTableName"> Database table name</param>
public void AddTable(ref DataSet oDS, string strTableName)
{
OleDbCommand selectCmd;
selectCmd = new OleDbCommand("SELECT * FROM " + strTableName,
m_connGeneric);
OleDbDataAdapter DAGeneric = new OleDbDataAdapter(selectCmd);
DAGeneric.FillSchema(oDS, SchemaType.Source, strTableName); // on
the table in question this call fails to load the Schema into the
DataSet.
DAGeneric.Fill(oDS, strTableName); //Error reported occurs here
}
table added has 97 fields defined, 93 text fields of varying lengths,
3 number fields, 1 memo field.
With a machine with office 2003 this MDB opens correctly and
referencing the tables functions completely normally.
The same file (or a copy) placed on a machine with office 2007 returns
the error message when the specific table is referenced.
Copy back to the orignal machine and the access 2003 can access the
tables without issue.
Help!!!.
I have also created a VS.NET application to read the tables out of the
MDB, and the utility has the same results.
Below is the code snippet identifying where the error occurs. On a
machine with office 2003 this code functions normally and without
error, on a machine with office 2007 the error actually starts when
trying to read the schema from the MDB file.
using System;
using System.Data;
using System.Data.OleDb;
using System.IO;
using System.Globalization;
....
public class DataExportObj
{
private OleDbConnection m_connGeneric;
private string m_strExePath;
static public string m_sSepChar = "|";
/// <summary>
/// DataExportObj - Constructor.
/// </summary>
/// <param name="oDS"> Output dataset</param>
/// <param name="strTableName"> Database table name</param>
public DataExportObj(ref DataSet oDS, string strTableName)
{
//
// Identify where the program was run from to find the export
reference database.
//
string codebasefile =
System.Reflection.Assembly.GetExecutingAssembly().Location;
m_strExePath = Path.GetDirectoryName(codebasefile);
m_strExePath = Path.Combine(m_strExePath, "CSVDef.mdb");
m_connGeneric = new OleDbConnection();
m_connGeneric.ConnectionString = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDBatabase Locking Mode=1;Data
Source="
+ m_strExePath + ";Jet OLEDB:Engine Type=5;Jet OLEDB:Global Bulk
Transactions=1;Provider=\"Microsoft.Jet.OLEDB.4.0\";Jet
OLEDB:SFP=False;Mode=Share Deny None;Jet OLEDB:Create System
Database=False;Jet OLEDBon't Copy Locale on Compact=False;Jet
OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet
OLEDB:Encrypt Database=False";
m_connGeneric.Open();
AddTable(ref oDS, strTableName);
}
/// <summary>
/// AddTable - Add a table to the existing dataset.
/// </summary>
/// <param name="oDS"> Output dataset</param>
/// <param name="strTableName"> Database table name</param>
public void AddTable(ref DataSet oDS, string strTableName)
{
OleDbCommand selectCmd;
selectCmd = new OleDbCommand("SELECT * FROM " + strTableName,
m_connGeneric);
OleDbDataAdapter DAGeneric = new OleDbDataAdapter(selectCmd);
DAGeneric.FillSchema(oDS, SchemaType.Source, strTableName); // on
the table in question this call fails to load the Schema into the
DataSet.
DAGeneric.Fill(oDS, strTableName); //Error reported occurs here
}