April 14, 2005 at 12:28 am
Hi, I m new to SQLDMO programming and did a google search and came to this forum. I found very useful code snippets on SQLDMO and managed to solve some of my requirements. But I encountered an error when I tried to add a new database using these code :
Public Sub CreateNewDB()
Dim oSQLSVR2 As SQLServer2
Dim oDatabase As SQLDMO.Database
Dim nDatabase As SQLDMO.Database
Dim nDBFile As SQLDMO.DBFile
Dim sqlTransfer2 As SQLDMO.Transfer2
Set oSQLSVR2 = New SQLServer2
Set nDatabase = New SQLDMO.Database
Set nDBFile = New SQLDMO.DBFile
oSQLSVR2.LoginSecure = True
oSQLSVR2.Connect SQL_PATH
nDatabase.Name = "test"
nDBFile.Name = "test"
nDBFile.PhysicalName = "test"
oSQLSVR2.Databases.Add (nDatabase)
The error I encounter when it tries to execute the last line is
"[SQL-DMO]This property or method is not available until the object (or its parent if appropriate) has been added to a collection."
I m working on vb5.0 SP3. This is the constrain. Any help is appreciated.
Regards,
Chee Hwee.
April 14, 2005 at 4:26 pm
I guess you did not like the database with its db files (through filegroup object).
April 16, 2005 at 12:13 am
April 18, 2005 at 7:32 pm
Thanks Tahir,
I found that out after I posted the msg. Thanks a lot for your help. Now back to experimenting with SQLDMO.
Regards,
Chee Hwee.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply