Hi Folks,
First post here - I am aLAMP developer moving over to C# and I think it is great BUT I am just debugging the 1st parts of a new project in c# and keep hitting this problem: I have a simple form which when an update button is clicked an odbc class is fired which connectects to a CAD database file via a third party odbc driver and extracts info about the elements in the CAD model - simple database query which works and returns the data, it just poulates a number of rectangular arrays so the connection works and retrieves the correct data. This fully completes and the I run through to close the connections and clean up - it is then I get the above error and also a box pops up with the following message:
Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.
Seems to me like the connection is locked by something else but I cannot track it down!!
*** This is the code where the query is called from:
private
{
locConnToPlan.connectToPlanFile(
locConnToPlan.getWallDataFromPlan();
}
--------------------------------------------------------------------------------------------------------------------------------
*** This is the code from the seperate class for the odbc connection:
using
namespace
loadPlan =
loadPlan.Open();
errString =
sqlCommand =
sqlCommand.CommandText = sqlQuery;
sqlReader = sqlCommand.ExecuteReader();
wall_ID[rowCounter, 0] = sqlReader.GetChar(0);
wall_USERID[rowCounter, 0] = sqlReader.GetChar(1);
wall_LENGTH_SIDE_A[rowCounter, 0] = sqlReader.GetDouble(2);
wall_LENGTH_SIDE_B[rowCounter, 0] = sqlReader.GetDouble(3);
wall_SURFACE_SIDE_A[rowCounter, 0] = sqlReader.GetDouble(4);
wall_SURFACE_SIDE_B[rowCounter, 0] = sqlReader.GetDouble(5);
wall_SURFACE_SIDE_C[rowCounter, 0] = sqlReader.GetDouble(6);
wall_CENTER_LENGTH[rowCounter, 0] = sqlReader.GetDouble(7);
rowCounter++;
sqlReader.Close();
sqlReader.Dispose();
sqlCommand.Dispose();
loadPlan.Close();
loadPlan.Dispose();
--------------------------------------------------------------------------------------------------------
The errors occur when the code gets throug to loadPlan.Close();
Any help to get this resolved would be much apreciated as I seem to be going around in circles.
Thanks