Hi guys,
I am trying to read out some tables of a regular XP access mdb but I keep getting an error message that I have no read privileges.
string strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDatabaseFile;
string strSQL = "SELECT Name FROM MSysObjects WHERE Type = 1;";
OleDbConnection myConn = new OleDbConnection(strDSN);
OleDbCommand myCmd = new OleDbCommand( strSQL, myConn );
OleDbDataReader datareader = null;
try
{
myConn.Open();
datareader = myCmd.ExecuteReader(CommandBehavior.CloseConnection);
while (datareader.Read() )
{
string strTest = (string) datareader["Name"];
MessageBox.Show(strTest,"hi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch (Exception ee)
{
MessageBox.Show("Sorry, I was not able to read from " + strDatabaseFile + ":\n\n" + ee.Message, "An error occured", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
finally
{
myConn.Close();
}
Am I missing something here?
I am trying to read out some tables of a regular XP access mdb but I keep getting an error message that I have no read privileges.
string strDSN = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDatabaseFile;
string strSQL = "SELECT Name FROM MSysObjects WHERE Type = 1;";
OleDbConnection myConn = new OleDbConnection(strDSN);
OleDbCommand myCmd = new OleDbCommand( strSQL, myConn );
OleDbDataReader datareader = null;
try
{
myConn.Open();
datareader = myCmd.ExecuteReader(CommandBehavior.CloseConnection);
while (datareader.Read() )
{
string strTest = (string) datareader["Name"];
MessageBox.Show(strTest,"hi", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
catch (Exception ee)
{
MessageBox.Show("Sorry, I was not able to read from " + strDatabaseFile + ":\n\n" + ee.Message, "An error occured", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
finally
{
myConn.Close();
}
Am I missing something here?