create database for mssql

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
CharlesMcAllister
Fresh Boarder
Fresh Boarder
Posts: 19
Joined: 25.10.2006, 19:25

create database for mssql

Post by CharlesMcAllister »

Please help!
I found it easy to connect TZConnection to a non-existent firebird database by specifying the 'CREATE DATABASE' sql in the TZConnection.Properties property.

However, how is this done with MSSQL 2005? (specifically i'm testing with the express edition).

How do i connect to MSSQL and create the database using ZLib?
Help is greatly appreciated.
CharlesMcAllister
Fresh Boarder
Fresh Boarder
Posts: 19
Joined: 25.10.2006, 19:25

Post by CharlesMcAllister »

I'm going to try using the ZPlainADO unit and create the database manually...

AConnection := CoConnection.Create;
AConnection.Open(...);
AConnection.Execute('CREATE DATABASE...');
AConnection.Close;

If someone knows a better way let me know. Thanks!
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Hi Charles,

You can execute this create right from a normal query component, so you don't have to use the ZPlainADO unit directly.
Query.Text:='Create...';
Query.ExecSQL
Or can't you connect to the database with a ZConnection if the database is not present? For mysql it should work this way.

Mark
Post Reply