ExecuteWithResultsAndMessages doesnt return message

  • hi there,

    i have a problem with the ExecuteWithResultsAndMessages command executed in a vbs script.

    the following statements becomes the resultset in in the tblResult1 object but the expected message, like 'nn rows affected', is missing.

    i tried every syntax (also the ExecuteWithResultsAndMessages2 command) but nothing gives me the message.

    does anyone have an idea what i make wrong.

    searching aroung the internet or microsoft or anything else doesnt help me.

    Set objSQLServer1 = CreateObject("SQLDMO.SQLServer")

    objSQLServer1.LoginSecure = True

    objSQLServer1.LoginTimeout = 3

    objSQLServer1.Connect "sqlserver"

    Set objDB1 = objSQLServer1.Databases("sqldatabase")

    tblQuery1 = "SELECT * from sqltable"

    Set tblResult1 = objSQLServer1.ExecuteWithResultsAndMessages(tblQuery1, sMessages, Len(tblQuery1))



  • Hi,

    I have not much idea of the DMO. But why dont you use the records count of the resulting table?

    You can try:


    I hope this will be helpful to you.


  • the 'nn rows affected' message was only a little sample for what i mean.

    the really important messages like error messages and so on are the real background on this question.



  • Hi,

    I usually display the errors through a try and catch;


    //Your code


    Console.WriteLine("Execution completed without any error(s)")

    Catch ex As FailedOperationException

    Dim err As SqlClient.SqlException = CType(CType(ex.InnerException, ExecutionFailureException).InnerException, SqlClient.SqlException)

    Console.Writeline("Line " & err.LineNumber & " Message " & err.Message & " Error " & err.Number & " State " & err.State & vbCrLf)

    End Try

    Hope this helps!



  • one year has gone but the problem is the same.

    so i like to ask again, if anyone has a working VBS with the DMO command "ExecuteWithResultAndMessage" where the results and also the messages comes back.

    kind regards


  • Is there a compelling need to do it in VBS? If you can use .NET then it's relatively easy - there's an event on SqlConnection that you just hook on to...

    Atlantis Interactive - SQL Server Tools
    My blog[/url]
    Why I wrote a sql query analyzer clone

  • yes, unfortunately there is a need for vbs because i have about 13000 lines of code in a HTA (vbs/wmi) and i dont want to recode this in another language, which i furthermore not be able to code.



Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply