Month: October 2008

Cross Page Posting in ASP.NET

I answered a question on the forums today with someone asking about the PreviousPage property that we have access to now. Basically, the question was Okay now I have the previous page but I want to cast it to that partial class type and it says it can’t find it. So if we have a page name Simba we would like to do the following: Dim simbaPage as Simba = CType(me.PreviousPage,Simba) The answer is pretty simple. You just need to place a @Reference into the HTML code on the page you are trying to do the cast on … Now the Simba class is available to you....

Read More

SMO Tips & Tricks: BEWARE the scary Connect option!

So if you are playing around in the SMO codescape you may have noticed the in the server object you have a connect method available …specifically Server.ConnectionContext.Connect While it may seems perfectly reasonable that you would want to control the destiny of your connection object…you will want to be wary. The Server Management Objects do a perfectly good job of handling opening and closing of the connection. If you chose to use the Connect method then you have just dumped that responsibility into your own hands. So be sure that if you use it you account for every instance when an error may occur and the connection needs to be closed down gracefully. You have been warned….....

Read More

SMO Tips & Tricks: Improving SMO Performance.

One of the few limiting factors with SMO is that if you do not know what you are doing and iterating through large numbers of databases it will seem extremely slow…..If you would look through profiler you would see why. Everytime you call on an object property it makes a new call to the database. That can make for a pretty damn chatty application. However, the server object provides a way in which you can speed this up …the SetDefaultInitFields() method. This allows you to tell the server object that you are wanting to ‘preload’ certain traits of objects when they are initially populated within the object. This cuts down on the calls back to the database and dramatically speeds up performance. For example…… Dim oServer as Server = New Server("AdventureWorks") oServer.SetDefaultInitFields(GetType(Database), "CompatibilityLevel")oServer.SetDefaultInitFields(GetType(Database), "Name")oServer.SetDefaultInitFields(GetType(Database), "IsSystemObject")oServer.SetDefaultInitFields(GetType(StoredProcedure), "Name")oServer.SetDefaultInitFields(GetType(View), "Name")oServer.SetDefaultInitFields(GetType(StoredProcedure), "TextBody") Hope this helps!...

Read More

SSIS Tips & Tricks: Easiest way to implement SFTP

So if you are trying to use SSIS to do SFTP for a project and do not have a budget to just go out and buy a widget then here is a pretty quick solution for you. 1. Download and install WinSCP from here 2. Create a stored session for the ftp session. This is normally the easiest way and looks something like Now you are ready. The syntax for the command line for WinSCP is as follows… [WinSCP Path]\winSCP.exe  /script=[Script Path]\UploadFiles.txt I normally prefer to use this method as the script file is easier to modify if I have to quickly to perform the various FTP tasks. The help docs online for winSCP show the proper format. Now you just have to add an Execute Process Task to your Control Flow of your package and you are ready to roll. Hope this helps! Cheers,...

Read More

Using SMO Part I : Enumerating Servers

I should be posting a couple of different smaller application that I have had to code in the last week or so to help me out with things at work. Both demonstrate the amazingly helpful architecture of Server Management Objects(SMO) to help automate some otherwise daunting tasks. I thought it would be helpful if I put together a couple of quick posts concerning SMO in case anyone was wanting to get acquainted with it. This goes along with the direction that I think I am going to take my blog in after getting a lot of reader feedback…Thanks guys! More smaller snippets…the kind that you can take a five minute break to read and then give them a go …longer articles will still be coming but at a slower pace. Well then, on we go! SMO is basically the .NET’ified version of DMO. Much more user friendly in the end implementation and from my standpoint a lot more flexible. So in beginning to deal with SMO we would like to do a couple of things. 1. Enumerate Servers…What the heck is out there? 2. Find out things about the server object 3. Find out about the databases 4. Find out about tables 5. Learn how to access extended procedure….this is related to one of the apps so I had to throw it in. I will tackle all of these...

Read More
  • 1
  • 2