Problem to use the command generator

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
baba
Posts: 22
Joined: Thu 14 Apr 2005 16:40

Problem to use the command generator

Post by baba » Thu 14 Apr 2005 16:56

Hello,

I have this strange error when i try to generate the commands :!
Image

'baba' is the database name, not the schema name.

I get this message if i specifyan initial schema=public AND if i leave this field empty.
I must say postgresql is a fresh 8.0.2
all_guys is a view

A bug ????

seb

Just in case, the code :

Code: Select all

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace pro1
{
	/// 
	/// Description résumée de Form1.
	/// 
	public class Form1 : System.Windows.Forms.Form
	{
		private CoreLab.PostgreSql.PgSqlConnection pgSqlConnection1;
		private CoreLab.PostgreSql.PgSqlCommand pgSqlSelectCommand1;
		private CoreLab.PostgreSql.PgSqlDataAdapter pgSqlDataAdapter1;
		private CoreLab.PostgreSql.PgSqlCommand pgSqlSelectCommand2;
		private pro1.DataSet1 dataSet11;
		private DevExpress.XtraGrid.GridControl gridControl1;
		private DevExpress.XtraGrid.Views.Grid.GridView gridView1;
		private DevExpress.XtraGrid.Columns.GridColumn colguy_id;
		private DevExpress.XtraGrid.Columns.GridColumn colguy_nom;
		private DevExpress.XtraGrid.Columns.GridColumn colsociete_nom;
		private CoreLab.PostgreSql.PgSqlCommandBuilder pgSqlCommandBuilder1;
		/// 
		/// Variable nécessaire au concepteur.
		/// 
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Requis pour la prise en charge du Concepteur Windows Forms
			//
			InitializeComponent();

			//
			// TODO : ajoutez le code du constructeur après l'appel à InitializeComponent
			//
		}

		/// 
		/// Nettoyage des ressources utilisées.
		/// 
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Code généré par le Concepteur Windows Form
		/// 
		/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
		/// le contenu de cette méthode avec l'éditeur de code.
		/// 
		private void InitializeComponent()
		{
			this.pgSqlSelectCommand1 = new CoreLab.PostgreSql.PgSqlCommand();
			this.pgSqlConnection1 = new CoreLab.PostgreSql.PgSqlConnection();
			this.pgSqlDataAdapter1 = new CoreLab.PostgreSql.PgSqlDataAdapter();
			this.pgSqlSelectCommand2 = new CoreLab.PostgreSql.PgSqlCommand();
			this.dataSet11 = new pro1.DataSet1();
			this.gridControl1 = new DevExpress.XtraGrid.GridControl();
			this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
			this.colguy_id = new DevExpress.XtraGrid.Columns.GridColumn();
			this.colguy_nom = new DevExpress.XtraGrid.Columns.GridColumn();
			this.colsociete_nom = new DevExpress.XtraGrid.Columns.GridColumn();
			this.pgSqlCommandBuilder1 = new CoreLab.PostgreSql.PgSqlCommandBuilder();
			((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.gridControl1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
			this.SuspendLayout();
			// 
			// pgSqlSelectCommand1
			// 
			this.pgSqlSelectCommand1.CommandText = "select guy_id, guy_nom, societe_nom from all_guys";
			this.pgSqlSelectCommand1.Connection = this.pgSqlConnection1;
			this.pgSqlSelectCommand1.Name = "pgSqlSelectCommand1";
			// 
			// pgSqlConnection1
			// 
			this.pgSqlConnection1.ConnectionString = "Unicode=True;User Id=postgres;Password=postgres;Host=127.0.0.1;Database=baba;Prot" +
				"ocol=;Initial Schema=public;";
			this.pgSqlConnection1.Name = "pgSqlConnection1";
			this.pgSqlConnection1.Unicode = true;
			// 
			// pgSqlDataAdapter1
			// 
			this.pgSqlDataAdapter1.MissingSchemaAction = System.Data.MissingSchemaAction.Ignore;
			this.pgSqlDataAdapter1.SelectCommand = this.pgSqlSelectCommand2;
			this.pgSqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																										new System.Data.Common.DataTableMapping("Table", "all_guys", new System.Data.Common.DataColumnMapping[] {
																																																					new System.Data.Common.DataColumnMapping("guy_id", "guy_id"),
																																																					new System.Data.Common.DataColumnMapping("guy_nom", "guy_nom"),
																																																					new System.Data.Common.DataColumnMapping("societe_nom", "societe_nom")})});
			// 
			// pgSqlSelectCommand2
			// 
			this.pgSqlSelectCommand2.CommandText = "select * from all_guys";
			this.pgSqlSelectCommand2.Connection = this.pgSqlConnection1;
			this.pgSqlSelectCommand2.Name = "pgSqlSelectCommand2";
			// 
			// dataSet11
			// 
			this.dataSet11.DataSetName = "DataSet1";
			this.dataSet11.Locale = new System.Globalization.CultureInfo("fr-FR");
			// 
			// gridControl1
			// 
			this.gridControl1.DataSource = this.dataSet11.all_guys;
			// 
			// gridControl1.EmbeddedNavigator
			// 
			this.gridControl1.EmbeddedNavigator.Name = "";
			this.gridControl1.Location = new System.Drawing.Point(16, 8);
			this.gridControl1.MainView = this.gridView1;
			this.gridControl1.Name = "gridControl1";
			this.gridControl1.Size = new System.Drawing.Size(504, 304);
			this.gridControl1.TabIndex = 0;
			this.gridControl1.Text = "gridControl1";
			// 
			// gridView1
			// 
			this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
																							 this.colguy_id,
																							 this.colguy_nom,
																							 this.colsociete_nom});
			this.gridView1.GridControl = this.gridControl1;
			this.gridView1.Name = "gridView1";
			// 
			// colguy_id
			// 
			this.colguy_id.Caption = "guy_id";
			this.colguy_id.FieldName = "guy_id";
			this.colguy_id.Name = "colguy_id";
			this.colguy_id.VisibleIndex = 0;
			// 
			// colguy_nom
			// 
			this.colguy_nom.Caption = "guy_nom";
			this.colguy_nom.FieldName = "guy_nom";
			this.colguy_nom.Name = "colguy_nom";
			this.colguy_nom.VisibleIndex = 1;
			// 
			// colsociete_nom
			// 
			this.colsociete_nom.Caption = "societe_nom";
			this.colsociete_nom.FieldName = "societe_nom";
			this.colsociete_nom.Name = "colsociete_nom";
			this.colsociete_nom.VisibleIndex = 2;
			// 
			// pgSqlCommandBuilder1
			// 
			this.pgSqlCommandBuilder1.DataAdapter = this.pgSqlDataAdapter1;
			this.pgSqlCommandBuilder1.KeyFields = "guy_id";
			this.pgSqlCommandBuilder1.UpdatingTable = "all_guys";
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(544, 341);
			this.Controls.Add(this.gridControl1);
			this.Name = "Form1";
			this.Text = "Form1";
			this.Load += new System.EventHandler(this.Form1_Load);
			((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.gridControl1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		/// 
		/// Point d'entrée principal de l'application.
		/// 
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
			this.pgSqlDataAdapter1.Fill(this.dataSet11);
		}
	}
}

Yuri
Posts: 140
Joined: Mon 08 Nov 2004 12:07

Problem to use the command generator

Post by Yuri » Fri 15 Apr 2005 08:48

Thank you for your sample.
We reproduced your problem and fixed it. This fix will be included in the next PostgreSQLDirect .NET build. It will be available in about two weeks.

Post Reply