System.Transactions.Diagnostics.DiagnosticTrace throws an exception of initialization
I use .Net 2.0 and connect to a database access, on the
connection.open() I've this message "The type initializer for
'System.Transactions.Diagnotics.DiagnosticTrace' threw an exception"
Code :
public DataSet GetData(string SqlQuery)
{
using (OleDbConnection connection = new
OleDbConnection(m_ConnectionString))
{
connection.Open();
OleDbCommand command = new OleDbCommand(SqlQuery,
connection);
command.CommandType = CommandType.Text;
OleDbDataAdapter adapter = new
OleDbDataAdapter(command);
DataSet ds = new DataSet();
adapter.Fill(ds);
connection.Close();
return ds;
}
}
Thanks for your help
Date:Mon, 16 Jul 2007 07:39:44 -0000
Author:
|
Re: System.Transactions.Diagnostics.DiagnosticTrace throws an exception of initialization
By Deleting the Config.app & rebuilding the project we can get this
problem solved, but be sure to take backup copy of your work before
doing this
I get solved this problem doing this
On Jul 16, 12:39 pm, Wavounet wrote:
> I use .Net 2.0 and connect to a database access, on the
> connection.open() I've this message "The type initializer for
> 'System.Transactions.Diagnotics.DiagnosticTrace' threw an exception"
>
> Code :
>
> public DataSet GetData(string SqlQuery)
> {
> using (OleDbConnection connection = new
> OleDbConnection(m_ConnectionString))
> {
>
> connection.Open();
>
> OleDbCommand command = new OleDbCommand(SqlQuery,
> connection);
>
> command.CommandType = CommandType.Text;
>
> OleDbDataAdapter adapter = new
> OleDbDataAdapter(command);
>
> DataSet ds = new DataSet();
>
> adapter.Fill(ds);
>
> connection.Close();
>
> return ds;
> }
> }
>
> Thanks for your help
Date:Thu, 26 Jul 2007 00:39:19 -0700
Author:
|