Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQLDMO

Author  Topic 

mgour
Starting Member

1 Post

Posted - 2005-03-06 : 05:52:44
i wrote a sub in VB with this command

Dim oSrv As SQLDMO.SQLServer
Dim oDatabase As SQLDMO.Database
Dim oStoredProcedure As New SQLDMO.StoredProcedure

Set oSrv = New SQLDMO.SQLServer
oSrv.Connect ".", "sa"

Set oDatabase = oSrv.Databases("Northwind")
oStoredProcedure.Text = Text1.Text
oSrv.Databases.Item("northwind", "dbo").StoredProcedures.Add (oStoredProcedure)

i got a error in the add commande that says propertie not supported by the object
can someone say what is wrong or how to create a SP using sqldmo ?
thank you for the help

Michel gour

Stoad
Freaky Yak Linguist

1983 Posts

Posted - 2005-03-06 : 09:15:22
Set oDatabase = oSrv.Databases("Northwind")
oStoredProcedure.Name = "moss"
oStoredProcedure.Text = "create proc dbo.moss as declare @i int return"
oDatabase.StoredProcedures.Add oStoredProcedure

oSrv.Disconnect
Set oStoredProcedure = Nothing
Set oDatabase = Nothing
Set oSrv = Nothing
Go to Top of Page
   

- Advertisement -