954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

System.Transactions.Diagnostics.DiagnosticTrace' threw an exception

Imports MySql.Data.MySqlClient
Imports System.Data.SqlClient
Module connection
    Public conn As MySqlConnection
    Public Sub xconnect()
        conn = New MySqlConnection
        conn.ConnectionString = "Server=localhost;User=root;Database=test;pwd=;"
        Try
            <strong>conn.Open()</strong>
            MsgBox("Success")
            conn.Close()
        Catch ex As MySqlException
            MsgBox(ex.Message)
        Finally
            conn.Dispose()
        End Try

    End Sub
End Module


System.TypeInitializationException was unhandled
  Message="The type initializer for 'System.Transactions.Diagnostics.DiagnosticTrace' threw an exception."
  Source="System.Transactions"
  TypeName="System.Transactions.Diagnostics.DiagnosticTrace"
  StackTrace:
       at System.Transactions.Transaction.get_Current()
       at MySql.Data.MySqlClient.MySqlConnection.Open()
       at WindowsApplication1.connection.xconnect() in C:\Documents and Settings\Shodow\My Documents\VB.NET\WindowsApplication1\WindowsApplication1\connection.vb:line 9
       at WindowsApplication1.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\Shodow\My Documents\VB.NET\WindowsApplication1\WindowsApplication1\Form1.vb:line 4
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ContainerControl.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at System.Windows.Forms.Form.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at System.Windows.Forms.Control.set_Visible(Boolean value)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: System.Configuration.ConfigurationErrorsException
       BareMessage="Configuration system failed to initialize"
       Line=0
       Message="Configuration system failed to initialize"
       Source="System.Configuration"
       StackTrace:
            at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
            at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName)
            at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
            at System.Configuration.ConfigurationManager.GetSection(String sectionName)
            at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
            at System.Diagnostics.DiagnosticsConfiguration.GetConfigSection()
            at System.Diagnostics.DiagnosticsConfiguration.Initialize()
            at System.Diagnostics.DiagnosticsConfiguration.get_Sources()
            at System.Diagnostics.TraceSource.Initialize()
            at System.Diagnostics.TraceSource.get_Switch()
            at System.Transactions.Diagnostics.DiagnosticTrace..cctor()
       InnerException: System.Configuration.ConfigurationErrorsException
            BareMessage="Unrecognized configuration section system.serviceModel."
            Filename="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config"
            Line=142
            Message="Unrecognized configuration section system.serviceModel. (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Config\machine.config line 142)"
            Source="System.Configuration"
            StackTrace:
                 at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
                 at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
                 at System.Configuration.BaseConfigurationRecord.ThrowIfInitErrors()
                 at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
            InnerException:
Shodow
Junior Poster
115 posts since Jan 2011
Reputation Points: 14
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: