3

I have COMPUTER_WITH_DATABASE where is superserver firebird (windows) installed. Now i need to make c# application which will connect to this COMPUTER_WITH_DATABASE and create file .fdb like for example database.fdb to be later able to connect from other computers using for example part of string like:

COMPUTER_WITH_DATABASE\c:\database.fdb

But how to do it using fb API in c#?

2

1 Answer 1

9

with this code you can create a database:

...
using FirebirdSql.Data.Firebird;
...

FbConnectionStringBuilder builder = new FbConnectionStringBuilder();
builder.DataSource = "COMPUTER_WITH_DATABASE";
builder.UserID = "SYSDBA";
builder.Password = "m*******y";
builder.Database = @"c:\database.fdb";
builder.ServerType = FbServerType.Default;

FbConnection.CreateDatabase(builder.ConnectionString);
Sign up to request clarification or add additional context in comments.

4 Comments

FbConnection.CreateDatabase wants string (basically), not a Hashtable, hence this code is not completely correct.
Thank you, FbConnectionStringBuilder is best to use to create the connection string.
What if the database already exists. Does 'Create Database' deletes the old one?
you can just code >>>>>>>> string curFile = @"c:\database.fdb"; if (File.Exists(curFile) == true) { MessageBox.Show("Database is already existing!"); }<<<<<<<<<<< to detect if database is already available hope this help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.