Statechange event

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
mainzda

Statechange event

Post by mainzda » Sat 15 Jul 2006 12:03

Hi,
I think there is a bug with the 2.5 Version of postgresqldirect.net mobile.
Everytime when I want to add the StateChange event to that connection, VS says, that it can't load the System.Data.StateChangeEventArgs even the System.Data is already added. I can compile it, but if I run it, it says the the assemblies is not yet loaded.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 17 Jul 2006 07:57

Please describe the problem in detail.
When exactly VS says, that it can't load the System.Data.StateChangeEventArgs? When it says that the assemblies are not loaded yet?

Guest

Post by Guest » Mon 17 Jul 2006 09:10

When exactly VS says, that it can't load the System.Data.StateChangeEventArgs?
When I double click at the property windows from the connection to add the StateChange event.
When it says that the assemblies are not loaded yet?
I just have this code :

Code: Select all

using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using CoreLab.PostgreSql;

namespace NpgsqlTest
{
	/// 
	/// Zusammenfassung für Form1.
	/// 
	public class Form1 : System.Windows.Forms.Form
	{
		private CoreLab.PostgreSql.PgSqlConnection pgSqlConnection1;
		private System.Windows.Forms.MainMenu mainMenu1;

		public Form1()
		{
			//
			// Erforderlich für die Windows Form-Designerunterstützung
			//
			InitializeComponent();
			this.pgSqlConnection1.Open();
		}
		/// 
		/// Verwendete Ressourcen bereinigen.
		/// 
		protected override void Dispose( bool disposing )
		{
			base.Dispose( disposing );
		}
		#region Vom Windows Form-Designer generierter Code
		/// 
		/// Erforderliche Methode für die Designerunterstützung. 
		/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
		/// 
		private void InitializeComponent()
		{
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.pgSqlConnection1 = new CoreLab.PostgreSql.PgSqlConnection();
			// 
			// pgSqlConnection1
			// 
			this.pgSqlConnection1.ConnectionString = "User Id=postgres;Password=postgres;Host=localhost;Database=test;Schema=public;";
			// 
			// Form1
			// 
			this.Menu = this.mainMenu1;
			this.Text = "Form1";

		}
		#endregion

		/// 
		/// Der Haupteinstiegspunkt für die Anwendung.
		/// 

		static void Main() 
		{
			Application.Run(new Form1());
		}
	}
}
But if I run it, it says :
PgSqlException
the assembly of the ressource can't be found.

But if I try to comment the
this.pgSqlConnection1.Open();
it run. There is something with the assembly path I think[/quote]

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 17 Jul 2006 09:41

What version of PostgreSQLDirect .NET do you use (Std, Pro)?
Please send your project to the address provided in the readme file.

mzda
Posts: 1
Joined: Sat 15 Jul 2006 12:00

Post by mzda » Mon 17 Jul 2006 09:48

Hi Alexey,
im using version 2.5
I have sent my project to the email address in the readme file.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 18 Jul 2006 14:52

We reproduced the problem and now fixing it. Look forward to the next build.
To workaround this right now use the code like this:

Code: Select all

    private void Form1_Load(object sender, System.EventArgs e) {
      pgSqlConnection1.StateChange += new StateChangeEventHandler(pgSqlConnection1_StateChange);
    }

    private void pgSqlConnection1_StateChange(object sender, StateChangeEventArgs e) {
       //do something 
    }

Post Reply