开发环境
vs2008
windows 7
mysql5.1
public ArrayList GetData(string sql)
{
MySqlConnection conn = new MySqlConnection(_connStr);
MySqlCommand command = null;
MySqlDataReader reader = null;
ArrayList retData = new ArrayList();
try
{
command = conn.CreateCommand();
command.CommandText = sql;
conn.Open();
reader = command.ExecuteReader();
while (reader.Read())
{
if (reader.HasRows)
{
for (int i = 0; i < reader.FieldCount; i++)
{
retData.Add(reader[i]);
}
}
}
}
catch (System.Exception ex)
{
throw new System.Exception("data access error."+ex.Message);
}
conn.Close();
conn.Dispose();
command = null;
reader.Close();
reader.Dispose();
return retData;
}
debug 下正常,release下会出现问题
message如下:Unable to load DLL 'coredll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
StackTrace如下
at MySql.Data.Common.Semaphore.CreateSemaphore(IntPtr securityAttributes, Int32 initialCount, Int32 maximumCount, String name)
at MySql.Data.Common.Semaphore..ctor(Int32 initialCount, Int32 maximumCount)
at MySql.Data.MySqlClient.MySqlPool..ctor(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPoolManager.GetPool(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlConnection.Open()
at BackupAndMerge.DBAcess.GetData(String sql) in C:\Users\dhan\Documents\Visual Studio 2008\Projects\BackupAndMerge\src\BackupAndMerge\DBAcess.cs:line 27
vs2008
windows 7
mysql5.1
public ArrayList GetData(string sql)
{
MySqlConnection conn = new MySqlConnection(_connStr);
MySqlCommand command = null;
MySqlDataReader reader = null;
ArrayList retData = new ArrayList();
try
{
command = conn.CreateCommand();
command.CommandText = sql;
conn.Open();
reader = command.ExecuteReader();
while (reader.Read())
{
if (reader.HasRows)
{
for (int i = 0; i < reader.FieldCount; i++)
{
retData.Add(reader[i]);
}
}
}
}
catch (System.Exception ex)
{
throw new System.Exception("data access error."+ex.Message);
}
conn.Close();
conn.Dispose();
command = null;
reader.Close();
reader.Dispose();
return retData;
}
debug 下正常,release下会出现问题
message如下:Unable to load DLL 'coredll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
StackTrace如下
at MySql.Data.Common.Semaphore.CreateSemaphore(IntPtr securityAttributes, Int32 initialCount, Int32 maximumCount, String name)
at MySql.Data.Common.Semaphore..ctor(Int32 initialCount, Int32 maximumCount)
at MySql.Data.MySqlClient.MySqlPool..ctor(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPoolManager.GetPool(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlConnection.Open()
at BackupAndMerge.DBAcess.GetData(String sql) in C:\Users\dhan\Documents\Visual Studio 2008\Projects\BackupAndMerge\src\BackupAndMerge\DBAcess.cs:line 27
一般情况下,不应该出现此类问题。
这样的问题真的是很奇怪...