I have 2 versions of this application:
OLD:
Access 97 and VB6 - no issues
NEW:
Access 2010 and .net framework 4.0 C#
I can load the same data with no issues in the old version
When I open the new version, it dies before it completes. "Cannot open any more databases"
It is 1 db and 1 table I am using
Here is my code. I am trying to load a tree view:
Conf Billing
Date
Requestor
Client
It could have more than 1 date and clients.
Here is my code:
Code:
{
conn = newOleDbConnection(strCONNECTION);
conn.Open();
string strSQL1 = @"SELECT DISTINCT([Date Request Received]) FROM BILLING ORDER BY [Date Request Received] DESC";
OleDbCommand cmd1 = newOleDbCommand(strSQL1);
cmd1.Connection = conn;
cmd1.CommandType =CommandType.Text;
OleDbDataReader reader1 = cmd1.ExecuteReader();
//add date
while (reader1.Read())
{
dateNode = newTreeNode(reader1["Date Request Received"].ToString().Substring(0, 10), 1, 1);
rootNode.Nodes.Add(dateNode);
//add requestor(s)
string strSQL2 = @"SELECT DISTINCT(Requestor) FROM BILLING WHERE [Date Request Received] = #" + dateNode.Text + "#";
OleDbCommand cmd2 = newOleDbCommand(strSQL2);
cmd2.Connection = conn;
cmd2.CommandType = CommandType.Text;
OleDbDataReader reader2 = cmd2.ExecuteReader();
while (reader2.Read())
{
requestorNode = newTreeNode(reader2["Requestor"].ToString(), 4, 4);
dateNode.Nodes.Add(requestorNode);
//add client(s)
string strSQL3 = @"SELECT Client, [Internal Record ID] FROM BILLING WHERE REQUESTOR = '" + requestorNode.Text + "' AND [DATE REQUEST RECEIVED] = #" + dateNode.Text + "#";
OleDbCommand cmd3 = newOleDbCommand(strSQL3);
cmd3.Connection = conn;
cmd3.CommandType = CommandType.Text;
OleDbDataReader reader3 = null;
reader3 = cmd3.ExecuteReader();
while (reader3.Read())
{
requestorNode.Nodes.Add(reader3["Internal Record ID"].ToString(), reader3["Client"].ToString(), 2, 2);
}
}
}
}
catch (Exception ex)
{
MessageBox.Show("Error in Loading all: " + ex.Message);
}
finally
{
conn.Close();
}