When I try and create a database, I get an error as follows:

<quote>
Can't load file FesDatabase.cs under C:\Users\Jiri\Desktop\NETProvider\source\FirebirdSql\Data\Client\Native.

Check the file permission and the existence of that file.
</quote>

The fbembed.dll has been added to my project with the 'Copy to output directory' set to 'Always'

My application is a simple console application using c# .Net 4.0 with code which follows:

<code>
using System;
using FirebirdSql.Data.FirebirdClient;
using FirebirdSql.Data.Isql;

namespace Firebird_Test_1
{
class Program
{
public static void Main(string[] args)
{
            Console.WriteLine("Firebird Test 1!");

// TODO: Implement Functionality Here

            Console.WriteLine("Creating Databse...");
CreateDatabase();
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
}

static void CreateDatabase()
{
//specify the database name
string dbName = "test.fdb";
//instanciate a new connection stringbuilder
FbConnectionStringBuilder csb = new FbConnectionStringBuilder();
            csb.Database = dbName;
            csb.UserID = "SYSDBA";
            csb.Password = "masterkey";
            csb.ServerType = FbServerType.Embedded; //embedded server
//instanciate a connection object
            FbConnection con = new FbConnection(csb.ToString());
//check if the database exists
if (System.IO.File.Exists(dbName) == false)
//create the database as it didn't exist
            FbConnection.CreateDatabase(csb.ToString());
//run the script against the current connection
RunScript("Test.Sql", con);
}

static void RunScript(string ScriptName, FbConnection connection)
{
//get a reference to the executing assembly
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); //instanciate a textReader object initialised using a stream to the embedded resource System.IO.TextReader textReader = new System.IO.StreamReader(assembly.GetManifestResourceStream(ScriptName));

FbScript script = new FbScript(textReader.ReadToEnd().ToString());

//parse the script
            script.Parse();
//open the connection
            connection.Open();
            FbBatchExecution fbe = new FbBatchExecution(connection);
foreach (string cmd in script.Results)
{
//add each sql statement to the batch
                fbe.SqlStatements.Add(cmd);
}
//execute the batch
            fbe.Execute();
//close the connection
            connection.Close();
}
}
}
</code>

Can you please help?

Kind Regards, Wayne
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to