Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create SQL Server database in VB 6.0 2

Status
Not open for further replies.

JTS1

Programmer
Joined
May 24, 2004
Messages
1
Location
US
I know how to create an Access database from within VB.

Is there a way to create a new SQL database from within VB?

Any sample code?

Thanks!
 
maybe

CREATE DATABASE [TestDB] ON PRIMARY
(NAME = N'TestDB_Data',
FILENAME = N'D:\SQLServer2000\MSSQL\data\TestDB_Data.MDF',
SIZE = 1,
FILEGROWTH = 10%)
LOG ON
(NAME = N'TestDB_Log',
FILENAME = N'D:\SQLServer2000\MSSQL\data\TestDB_Log.LDF' ,
SIZE = 1,
FILEGROWTH = 10%)

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
try something along these line, make sure you refereance the SQLDMO object model

Code:
  Dim db As Database
    Dim sql As SQLDMO.SQLServer
       
    Set sql = New SQLDMO.SQLServer
    Set bd = New Database
    sql.Connect "SERVERNAME", "sa", ""
    db.Name = "Bombdrop_test_123"
   sql.Databases.Add db
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top