Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB Connectivity » View Thread |
Messages 1 to 3 of 3 total |
Create new database using DAC... |
Wed, Mar 11 2009 12:47 PM | Permanent Link |
David Loving | ElevateDB 202b9edbdacstd using .NET Data Provider and VS 2008.
I can manually use the ElevateDB Manager (Unicode) to create a new database name, link it to a folder and then open and run a .SQL script to create all tables, etc. How does one use the .NET Data Provider set of classes to create a new database name and link it to a folder? Please forgive if it is available somewhere in the .NET Data Provider docs... I haven't been able to find it. |
Wed, Mar 11 2009 6:02 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | David,
<< I can manually use the ElevateDB Manager (Unicode) to create a new database name, link it to a folder and then open and run a .SQL script to create all tables, etc. How does one use the .NET Data Provider set of classes to create a new database name and link it to a folder? >> You would use something like this: private void button1_Click(object sender, EventArgs e) { string cmdString = "CREATE DATABASE MyDatabase PATH 'c:\\myapp\\data' DESCRIPTION 'My Database'"; EDBConnection connection = new EDBConnection("CONFIGPATH=c:\\unicode;UID=Administrator;PWD=EDBDefault;DATABASE=Configuration"); connection.Open(); EDBCommand cmd = new EDBCommand(cmdString, connection); cmd.ExecuteNonQuery(); } Notice the use of the Configuration database in the connection string. Once you've created the database, you can use the ChangeDatabase method of the EDBConnection class to switch to the newly-created database. You can then run the script against the database to create all of the tables, etc. using an EDBCommand instance. Of course, you should take care to Dispose of the EDBCommand and EDBConnection instances when you're done with them. -- Tim Young Elevate Software www.elevatesoft.com |
Thu, Mar 12 2009 11:39 AM | Permanent Link |
David Loving | Excellent! Thank you!
|
This web page was last updated on Tuesday, September 17, 2024 at 04:19 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |