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