Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread .Net and creating a new database
Thu, Feb 25 2016 11:05 AMPermanent Link

Matthew Jones

Okay, assume I have a .Net application written with C#. I have the .Net
interface thingy. The .Net application is just starting up, and decides
it wants to create a new Session, and within that Session a new
database and some new tables in that. The location of each of those is
unknown at compile time. Is that all possible? There would be no EDB
Manager installed to assist, it has to do everything from scratch.


--

Matthew Jones
Thu, Feb 25 2016 2:33 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matthew,

<< Okay, assume I have a .Net application written with C#. I have the .Net interface thingy. The .Net application is just starting up, and decides it wants to create a new Session, and within that Session a new database and some new tables in that. The location of each of those is unknown at compile time. Is that all possible? There would be no EDB Manager installed to assist, it has to do everything from scratch. >>

Sure, you would do it just like you would in Delphi.  For example, the following code will create a database on the fly:

       private void button1_Click(object sender, EventArgs e)
       {
           EDBConnection DataConnection = new EDBConnection(@"NAME=Test;DESCRIPTION=Test Connection;TYPE=LOCAL;CONFIGPATH=C:\MyApp;DATABASE=Configuration;UID=Administrator;PWD=EDBDefault");

           DataConnection.Open();

           EDBCommand DataCommand = new EDBCommand();

           DataCommand.Connection = DataConnection;

           // Create the database

           DataCommand.CommandText = @"CREATE DATABASE MyDatabase PATH 'c:\myapp\mydata'";
           DataCommand.ExecuteNonQuery();

           DataConnection.ChangeDatabase("MyDatabase");

           DataConnection.Close();
       }

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Feb 26 2016 3:55 AMPermanent Link

Matthew Jones

Tim Young [Elevate Software] wrote:

> Sure, you would do it just like you would in Delphi.  For example,
> the following code will create a database on the fly:

Many thanks.


--

Matthew Jones
Image