// project created on 2003-8-10 at 17:28
using System;
using System.Windows.Forms;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Configuration;
using FirebirdSql.Data.Firebird;
namespace MyFormProject
{
class MainForm : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button;
private System.Windows.Forms.DataGrid dataGrid;
public MainForm()
{
InitializeComponent();
}
// THIS METHOD IS MAINTAINED BY THE FORM DESIGNER
//do
NOT EDIT IT MANUALLY! YOUR CHANGES ARE LIKELY TO BE LOST
void buttonClick(object sender, System.EventArgs e)
{
string myConnectionString =
"User=SYSDBA;" +
"Password=masterkey;" +
"Database=G://haiguan//ibase//SYSTEM.GDB;" +
"DataSource=localhost;" +
"Port=3050;" +
"Dialect=3"+
"Connection lifetime=30;" +
"Pooling=true;" +
"Packet Size=8192";
FbConnection fb = new FbConnection(myConnectionString);
fb.Open();
FbDataAdapter fda = new FbDataAdapter();
FbTransaction ft = fb.begin
Transaction();
fda.SelectCommand = new FbCommand("select * from JYDW",fb,ft);
DataSet ds = new DataSet();
fda.Fill(ds);
dataGrid.DataSource = ds;
//dataGrid.DataBind();
fb.Close();
}
void InitializeComponent() {
this.dataGrid = new System.Windows.Forms.DataGrid();
this.button = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGrid)).begin
Init();
this.SuspendLayout();
this.dataGrid.SuspendLayout();
//
// dataGrid
//
this.dataGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGrid.DataMember = "";
this.dataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid.Location = new System.Drawing.Point(24, 24);
this.dataGrid.Name = "dataGrid";
this.dataGrid.Size = new System.Drawing.Size(232, 160);
this.dataGrid.TabIndex = 0;
//
// button
//
this.button.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button.Location = new System.Drawing.Point(56, 216);
this.button.Name = "button";
this.button.Size = new System.Drawing.Size(96, 24);
this.button.TabIndex = 1;
this.button.Text = "button";
this.button.Click += new System.EventHandler(this.buttonClick);
//
// MainForm
//
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button,
this.dataGrid});
this.Text = "This is my form";
((System.ComponentModel.ISupportInitialize)(this.dataGrid)).EndInit();
this.dataGrid.ResumeLayout(false);
this.ResumeLayout(false);
}
[STAThread]
public static void Main(string[] args)
{
Application.Run(new MainForm());
}
}
}
////////////我用的是firebird1。5rc5。
//到firebird.sourceforge.net下载.net驱动
//csc /r:F:/w2k/FirebirdNetProvider/FirebirdSql.Data.Firebird.dll;System.Data.dll %1是编译命令。
//