views:

984

answers:

3

Hi folks,

I've got a web application that uses Microsoft Sql Management Objects (SMO) dll's. I'm wondering how I go about redistributing the libraries for a remote machine.

As I understand it, these come with SQL server or Sql express - which isn't on the remote (shared) webserver. Asking the host to install them, is probably out of the question, so is it possible to dynamically load them?

See below error-

Could not load file or assembly 'Microsoft.SqlServer.Smo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

Alternatively, if anyone can provide a workaround for the below snippet that would also be useful. The script variable is a SQL install script which has been read to the end. The nice thing about this is the outputting of each of the execute strings from SQL. I could of course just execute it all in one chunk, but that provides no visual feedback to the user line by line, that the sql is executing ok.

Is there a stored procedure that could perform this sort of thing? Or an alternative way to execute an install script without full permissions.

           Dim connection As New SqlConnection(Me.ConnectionString)

            connection.Open()
            connection.Close()

            Dim server As New Server(New ServerConnection(connection))
            server.ConnectionContext.SqlExecutionModes = SqlExecutionModes.ExecuteAndCaptureSql
            Dim commands As StringCollection = server.ConnectionContext.CapturedSql.Text
            server.ConnectionContext.ExecuteNonQuery(script, ExecutionTypes.ContinueOnError)





            Dim s As String
            For Each s In server.ConnectionContext.CapturedSql.Text
                AppendMessages(s)
            Next
+1  A: 

you can try using sqlcmd utilty that comes with sql server

Mladen Prajdic
Think that still requires admin access..this is for a shared hosting environment.
Paul
Mladen Prajdic
Needs to be a standalone solution, executed by a non techie user from a web application. So that is out too. Thanks though.
Paul
A: 

No, you can't dynamically load them, and no, you can't install them without permissions. Sorry about that, but no dice there.

Brent Ozar