Firebird SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesFirebird SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 1st, 2005, 12:13 PM
frrobert frrobert is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 38 frrobert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 52 m 45 sec
Reputation Power: 4
firebird & .net provider

Excuse the extreme Newbie question.
I am new to both C# and asp.net

I been looking on the web for some examples on how to use the .net provider for firebird. Does anyone know of any?

I've installed the .net provider and looked through the SDK documentation but to a newbie it is confusing.


Thanks

Fr. Robert

Reply With Quote
  #2  
Old April 2nd, 2005, 07:21 AM
aaronabend aaronabend is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 2 aaronabend User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 m 44 sec
Reputation Power: 0
What exactly do you need?

Not sure what you are looking for, but here is the connect statements I use:


(dbfile is a string that contains the path to your fbd file)

gsConnection="User=SYSDBA;Password=masterkey;Database="+dbfile+";DataSource=localhost;Port=3050;Dialect=3;Charset=NONE;Role=;Connection lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0";
gIDbConn = new FirebirdSql.Data.Firebird.FbConnection(gsConnection);
gIDbCommand = new FirebirdSql.Data.Firebird.FbCommand();
gIDbCommand.Connection = gIDbConn;
gIDAdapt = new FirebirdSql.Data.Firebird.FbDataAdapter();
giDbconn.Open();

Reply With Quote
  #4  
Old April 4th, 2005, 05:57 AM
voidberg voidberg is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 3 voidberg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 46 sec
Reputation Power: 0
Also there are some examples on the Firebird page.

Reply With Quote
  #5  
Old April 4th, 2005, 09:11 AM
frrobert frrobert is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 38 frrobert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 52 m 45 sec
Reputation Power: 4
firebird * .net provider

Thanks for the help.

It is slowly sinking in. I have a related question. Again excuse the newbie question. Will the datgrid control work with the firebird.net connector? I got it to work if I connected to firebird using ODBC.net connector but not if I used the firebird.net connector.

Thanks Again

Fr. Robert

Reply With Quote
  #6  
Old April 7th, 2005, 04:01 AM
ozzythewizard ozzythewizard is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 2 ozzythewizard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 44 m 4 sec
Reputation Power: 0
got the same problem

Hey frrobert. I got the same problem. I'm new to C# and Firebird. I got the connection established with .net provider and read some data but I can't insert new data into the database. If you find some examples on how to do it please let me know.

Thanks

Reply With Quote
  #7  
Old April 13th, 2005, 11:43 AM
fetcher fetcher is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Portugal
Posts: 106 fetcher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 11 m 33 sec
Reputation Power: 6
Here goes a very simple example, not paying attention to best practices , of how to bind a table to a datagrid and how to insert a new record to the same table.

controls in aspx page:
- 1 one datagrid
- 1 textbox
- 1 button

Code:
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button Button1;

private void Page_Load(object sender, System.EventArgs e)
{
	if(!IsPostBack)
	{
		BindData();
	}
}

private void BindData()
{
	FbConnectionStringBuilder cs = new FbConnectionStringBuilder();

	cs.DataSource = "localhost";
	cs.UserID     = "SYSDBA";
	cs.Password     = "masterkey";
	cs.Database     = "C:\\Program Files\\Firebird\\data.fdb";

	string connectionString = cs.ToString();


	FbConnection connection = new FbConnection(connectionString);                    
	connection.Open();                    

	string selectQuery = "SELECT ID, NOME FROM TESTE";
	FbDataAdapter da = new FbDataAdapter(selectQuery,connection);
	
	DataSet ds = new DataSet();
	da.Fill(ds);
	DataGrid1.DataSource = ds;
	DataGrid1.DataBind();
			

	connection.Close();

}

private void Button1_Click(object sender, System.EventArgs e)
{
	if(TextBox1.Text!= string.Empty)
	{
		FbConnectionStringBuilder cs = new FbConnectionStringBuilder();

		cs.DataSource = "localhost";
		cs.UserID     = "SYSDBA";
		cs.Password     = "masterkey";
		cs.Database     = "C:\\Program Files\\Firebird\\data.fdb";

		string connectionString = cs.ToString();

		FbConnection connection = new FbConnection(connectionString);                    
		connection.Open();                    
		FbTransaction transaction = connection.BeginTransaction();

		string newName = Server.HtmlEncode(TextBox1.Text.Trim());
		string insertQuery = "INSERT INTO TESTE(NOME) Values('" + newName + "')";
		
		FbCommand command = new FbCommand(insertQuery, connection, transaction);    

		command.ExecuteNonQuery();

		transaction.Commit();

		connection.Close();

		TextBox1.Text = string.Empty;
		BindData();
	}

}

Reply With Quote
  #8  
Old April 14th, 2005, 08:59 AM
frrobert frrobert is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 38 frrobert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 h 52 m 45 sec
Reputation Power: 4
Thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesFirebird SQL Development > firebird & .net provider


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT