' Execute a SQL script ' expC1 Script ' expL1 Execute with results Public Function ExecuteSQLScript(ByVal tcScript As String, _ Optional ByVal tlExecuteWithResult As Boolean = False) As Boolean Dim lcConnectionString As String = "" Dim lcScript As String = "" Dim llSuccess As Boolean = False Dim lnDateNow As Double = 0 Dim lnDateNow2 As Double = 0 Dim lnElapse As Double = 0 Dim loServer As Server = Nothing Dim loServerConnection As ServerConnection = Nothing Dim loSQLConnection As SqlConnection = Nothing ' Reset the values cScriptMessage = "" nDuration = 0 ' Start time lnDateNow = Date.Now.Ticks ' Initialize the data object If Not InitializeDataObject("") Then Return False End If Try ' Get the proper definition as per the current scope If oProcess Is Nothing Then lcConnectionString = oApp.aConnection(nConnectionString, 1) Else lcConnectionString = oProcess.aConnection(nConnectionString, 1) End If ' Initialize the SMO object loSQLConnection = New SqlConnection(lcConnectionString) loServerConnection = New ServerConnection(loSQLConnection) loServer = New Server(loServerConnection) ' Add the event handler AddHandler loSQLConnection.InfoMessage, New SqlInfoMessageEventHandler(AddressOf ScriptMessage) ' In SQL Server, we have to turn off ANSI Warnings as we will have an error ' if a field value is greater than the field length lcScript = lcScript + "SET ANSI_WARNINGS OFF" + oApp.cCR ' Get the script lcScript = lcScript + tcScript ' We execute with result If tlExecuteWithResult Then oDataSet = New DataSet ' Execute the script oDataSet = loServer.ConnectionContext.ExecuteWithResults(lcScript) ' Adjust to our default name oDataSet.Tables("Table").TableName = "Temp" ' Record count nCount = oDataSet.Tables("Temp").Rows.Count ' If we have at least one record If nCount > 0 Then oDataView = New DataView oDataView = oDataSet.Tables("Temp").DefaultView oRows = oDataSet.Tables("Temp").Rows() Else oRows = Nothing End If Else ' Execute the script loServer.ConnectionContext.ExecuteNonQuery(lcScript) End If llSuccess = True Catch loError As Exception ErrorSetup(loError, lcScript) End Try ' End time lnDateNow2 = Date.Now.Ticks lnElapse = ((lnDateNow2 - lnDateNow) / 10000000) ' Just in case If lnElapse > 999.999 Then lnElapse = 999.999 End If nDuration = lnElapse cSQLFull = lcScript ' Add the log oLogData.cLog = cSQLFull + oApp.cCR + oApp.cCR + "Duration: " + oApp.GetFormatValue(nDuration, , 4) oLogData.lTimeStamp = True If Not oLogData.AddLog() Then End If Return llSuccess End FunctionThe framework Data class has a lot of database methods. The other ones were able to be executed without this error (before I had to build a config file). I am wondering why this particular one triggers something in regards to a 2.0 version. Maybe the AddHandler would be a problem?