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

namespace DataGridFill
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
        private DataSet ds;

        private GBS.Data.GBasedbt.IfxDataAdapter ifxDataAdapter1;
        private GBS.Data.GBasedbt.IfxConnection IfxConnection1;
        private GBS.Data.GBasedbt.IfxCommand IfxSelectCommand1;
        private System.Windows.Forms.DataGrid dataGrid1;
        private System.Windows.Forms.Button FillDataButton;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.ifxDataAdapter1 = new GBS.Data.GBasedbt.IfxDataAdapter();
            this.IfxSelectCommand1 = new GBS.Data.GBasedbt.IfxCommand();
            this.IfxConnection1 = new GBS.Data.GBasedbt.IfxConnection();
            this.FillDataButton = new System.Windows.Forms.Button();
            this.dataGrid1 = new System.Windows.Forms.DataGrid();
            ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
            this.SuspendLayout();
            // 
            // ifxDataAdapter1
            // 
            this.ifxDataAdapter1.SelectCommand = this.IfxSelectCommand1;
            this.ifxDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
                                                                                                      new System.Data.Common.DataTableMapping("Table", "customer", new System.Data.Common.DataColumnMapping[] {
                                                                                                                                                                                                                  new System.Data.Common.DataColumnMapping("customer_num", "customer_num"),
                                                                                                                                                                                                                  new System.Data.Common.DataColumnMapping("fname", "fname"),
                                                                                                                                                                                                                  new System.Data.Common.DataColumnMapping("lname", "lname"),
                                                                                                                                                                                                                  new System.Data.Common.DataColumnMapping("company", "company"),
                                                                                                                                                                                                                  new System.Data.Common.DataColumnMapping("address1", "address1"),
                                                                                                                                                                                                                  new System.Data.Common.DataColumnMapping("address2", "address2"),
                                                                                                                                                                                                                  new System.Data.Common.DataColumnMapping("city", "city"),
                                                                                                                                                                                                                  new System.Data.Common.DataColumnMapping("state", "state"),
                                                                                                                                                                                                                  new System.Data.Common.DataColumnMapping("zipcode", "zipcode"),
                                                                                                                                                                                                                  new System.Data.Common.DataColumnMapping("phone", "phone")})});
            // 
            // IfxSelectCommand1
            // 
            this.IfxSelectCommand1.CommandText = "SELECT * FROM customer";
            this.IfxSelectCommand1.Connection = this.IfxConnection1;
            // 
            // IfxConnection1
            // 
            this.IfxConnection1.ClientLocale = "en_us.CP1252";
            this.IfxConnection1.ConnectionString = "Server=ids940uc2; DataBase=stores7; ";
            this.IfxConnection1.DatabaseLocale = "";
            this.IfxConnection1.FetchBufferSize = 32767;
            this.IfxConnection1.PacketSize = 32767;
            // 
            // FillDataButton
            // 
            this.FillDataButton.Location = new System.Drawing.Point(624, 16);
            this.FillDataButton.Name = "FillDataButton";
            this.FillDataButton.TabIndex = 0;
            this.FillDataButton.Text = "Fill Data";
            this.FillDataButton.Click += new System.EventHandler(this.FillDataButton_Click);
            // 
            // dataGrid1
            // 
            this.dataGrid1.DataMember = "";
            this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
            this.dataGrid1.Location = new System.Drawing.Point(8, 48);
            this.dataGrid1.Name = "dataGrid1";
            this.dataGrid1.Size = new System.Drawing.Size(712, 288);
            this.dataGrid1.TabIndex = 1;
            // 
            // Form1
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(728, 349);
            this.Controls.Add(this.dataGrid1);
            this.Controls.Add(this.FillDataButton);
            this.Name = "Form1";
            this.Text = "Form1";
            ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
            this.ResumeLayout(false);

        }
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

        private void FillDataButton_Click(object sender, System.EventArgs e)
        {
            IfxConnection1.Open ();
            ds = new DataSet ();
            ifxDataAdapter1.Fill (ds);
            dataGrid1.SetDataBinding( ds, "customer" );
        }
	}
}
