显示标签为“smo”的博文。显示所有博文
显示标签为“smo”的博文。显示所有博文

2012年3月22日星期四

Anybody played with SmoBrowser example within smo?

I was looking at the smo examples that come with sql server 2005/VS 2005

and I have found quite interesting how it was neat and easy to load everthing in a treeview using reflection.

I come to my question:

I would like to load a treeview control that I could reuse in the same way but depending on the needs i would like only to load certain stuff not all of them.

EG (Not all objects but just DatabaseCollection,TableCollection)

Is there a way I can ovverride IsExpandablePropertyType so that i can decide what i can load?

any suggestions

I have adopted the SMOBrowser source code to upgrade one our products, SQL2000Print that prints SQL Server 2000 object information using DMO. The new product will do the same for SQL Server 2005 using SMO. I load the treeview only with the database objects that I want to load, and in a structure that is similar to Microsoft SQL Server Management Studio.

I have uploaded a development version to our website (here is the download link http://www.starprint2000.com/downloads/beta/sqlserverprint2005.msi) that prints Tables, Views and Stored Procedures from SQL Server 2005. You are welcome to download it and try it.

If you want to load your treeview the same/simliar way please let me know, I will be happy to share the code for loading the Treeview.

Regards,

Joginder Nahil
www.starprint2000.com

|||

Hi there

thanks for your reply.I would be extremely grateful if you could share the code for the treeview .

you can email it at vbjunkie@.hotmail.co.uk and let me know.

Thanks a lot

|||

I have modified the SMOBrowser example, that you download using the following link, to demonstrate how you can load the treeview with the datbase objects of your choice.

http://www.starprint2000.com/downloads/SmoBrowser.zip

The zip file contains readme.doc that documents the changes and provides information showing how I loaded the Treeview using XML to my own tree structure.

Regards,

Joginder Nahil
www.starprint2000.com

|||

Thanks a lot for your link.

One last question.In one scenario I just wanted to load one database,not all of them.

Can i do that?

thanks again

|||

I have modified the SMOBrowser example, that you download using the following link, to demonstrate how you can load the treeview with the database objects of your choice AND only the database in the list:.

http://www.starprint2000.com/downloads/SmoBrowserDBOnly.zip

I have modified the code for procedure PopulateCollectionItems to check if the item to be loaded is a Database object and its name is in the list of names to be loaded.

Private Sub PopulateCollectionItems(ByVal node As TreeNode)
Dim oldCursor As Cursor = Me.Cursor
Me.Cursor = Cursors.WaitCursor
Try
For Each item As Object In CType(node.Tag, ICollection)
Select Case TypeName(item)
Case "Database"
If DatabasesToLoadList.Contains(CType(item, Database).Name) Then
node.Nodes.Add(CreateNode(item))
End If
Case Else
node.Nodes.Add(CreateNode(item))
End Select
Next
Finally
Me.Cursor = oldCursor
End Try
End Sub

Regards,

Joginder Nahil
www.starprint2000.com

|||

I have modified the SMOBrowser example, that you download using the following link, to demonstrate how you can load the treeview with the database objects of your choice AND only the database in the list:.

http://www.starprint2000.com/downloads/SmoBrowserDBOnly.zip

I have modified the code for procedure PopulateCollectionItems to check if the item to be loaded is a Database object and its name is in the list of names to be loaded.

Private Sub PopulateCollectionItems(ByVal node As TreeNode)
Dim oldCursor As Cursor = Me.Cursor
Me.Cursor = Cursors.WaitCursor
Try
For Each item As Object In CType(node.Tag, ICollection)
Select Case TypeName(item)
Case "Database"
If DatabasesToLoadList.Contains(CType(item, Database).Name) Then
node.Nodes.Add(CreateNode(item))
End If
Case Else
node.Nodes.Add(CreateNode(item))
End Select
Next
Finally
Me.Cursor = oldCursor
End Try
End Sub

Regards,

Joginder Nahil
www.starprint2000.com

|||

Fantastic!!

Thanks a lot for your very good reply and quick answer!

2012年2月18日星期六

Any help on this SMO request?

My evaluation copy ran-out and I uninstlaled the previous and installed anothrer evaluation edition. The installation was successful. I created a SSIS package importing a tale from Oracle 10G XE to the SQL 2005 on my machine. I saved the package on the server. The SSIS service is working but when I try to refresh the node, I get this message. The help linl leads to no where:

--

TITLE: Microsoft SQL Server Management Studio

Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476


ADDITIONAL INFORMATION:

Login timeout expired
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.
TCP Provider: No connection could be made because the target machine actively refused it. (Microsoft SQL Native Client)

Login timeout expired
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.
TCP Provider: No connection could be made because the target machine actively refused it. (Microsoft SQL Native Client)

My efforts so far:

I have verified the items in the Surface area screen, everythign looks good.

SSIS service has started.

Both teh Network Server TCP/IP dynmaic port and the SQL Client TCP/IP dynamic port are the same.

I have no problem logging in to any of the services. But I get this message.

I tried to create a package from Visual Studio, but that also did not succeed.

In my previous set up, I created perhaps 1/ 2 dozen different packages.

I am puzzzled.

I appreciate if some one could throw some light.

If you could get the function call stack when the error occurs, that would help diagnose the problem. At the bottom of the exception message box, there is a little icon with a tooltip like "technical details" which displays this information.

Also, if you could provide more specific steps to reproduce the problem, that would help too. Are you using SSIS when you get this problem, or some Management Studio UI that uses SSIS, like the Copy Database Wizard? You can get more specific SSIS configuration help in the SSIS forum here: http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=80&SiteID=1

Thanks,
Steve