by Sivabalan.D (1 Submission)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 27th August 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Creating Sql Server DataBase
API Declarations
Dim MyServer As New SQLServer
Dim DataBase As New SQLDMO.DataBase
Dim DBFileData As New SQLDMO.DBFile
Dim LogFile As New SQLDMO.LogFile
Dim StrSuccess As String
Dim User As New SQLDMO.User
If Trim(TxtServer.Text) <> "" And Trim(TxTUser.Text) <> "" Then
DataBase.Name = "USMte" 'Ur DataBase Name
DBFileData.Name = "USMte"
DBFileData.PhysicalName = "c:\USMte.mdf"
DBFileData.PrimaryFile = True
DBFileData.FileGrowthType = SQLDMOGrowth_MB
DBFileData.FileGrowth = 1
DataBase.FileGroups("PRIMARY").DBFiles.Add DBFileData
LogFile.Name = "USMteLog"
LogFile.PhysicalName = "c:\USMtelog.ldf"
DataBase.TransactionLog.LogFiles.Add LogFile
MyServer.Databases.Add DataBase
MyServer.Disconnect
MsgBox "Created"
End If
End Sub