Alas, why this proc i cant capture the print ''hello'' ?????????

  • Alas, why this proc i cant capture the print 'hello' ?????????

     

    create proc SP_test

    as

    begin

    select '1'

    print 'hello'

    select '2'

    end

    ----------------------------------------------------------------------

    My visual script

    --------------------------------------------------------------------------

    on error goto error:

    Set cnn1 = New ADODB.Connection

      cnn1.ConnectionString = "driver={SQL Server};" & _

          "server=" & Trim(server) & ";uid=" & Trim(login) & ";pwd=" & Trim(pwd) & ";database=" & Trim(base)

      

       cnn1.ConnectionTimeout = 120

      cnn1.Open

      

      

       Set reg = New ADODB.Recordset

       Set reg = cnn1.Execute("exec SP_test")

    error:

      

       Dim Err As error

    For Each Err In cnn1.Errors

    MsgBox Err.Description & " : " & Err.Source & " : " & Err.SQLState & " : " & Err.Number

    Next

    cnn1.Close

    But if i take out the 'selects' i can do it

     

    create proc SP_test

    as

    begin

    print 'hello'

    end

     

  • Hey dude, you don't need to start 5 threads for the same question. You'll get your answer, don't worry.

  • Ok sorry, i will say to the wemaster that delete this

  • Why can't you use a select to do this already?

  • Just don't start another one .

  • the problem consists in that if exists some 'select' before the print, the print can not be captured, it does not show nothing...........

     

    with this i can capture 'Hello'

    create proc SP_test

    as

    begin

    print 'hello'

    end

    this i canot do it !

    create proc SP_test

    as

    begin

    select '1'

    print 'hello'

    end

    the select avoid the capture????......

  • See my other answer in the other thread.

    I've given you what I found... But I don't see how this can be done in vba. I suspect it can be done in .NET, but I still wouldn't know how...

  • Thank you a lot of i have to invite some beer for my disturbings......

  • No thanx... I don't drink.

  • Hector I am a little confused do you want to have the sp print the variable in vb or in query analyzer? Your offer of a cold beer reminded me that it was time for one so cheers. Let me know where you want your printed output.

    Mike 

  • That's exactly why I didn't want him to pen 5 threads for this problem.

    IIRC, he wanted to be able to show the print messages (probabely for debuging) client side, in a msgbox. He didn't say much more than that except that he couldn't change the application but could alter the procs.

  • Check BOL for Handling Errors and Messages in ADO . Index key word error object. The example uses a list object to store the error values but it should be simple to modify this code to place a string in a message box to display the error information. Also check BOL under RAISEERROR.

    HTH Mike

  • Any thing printed in back ground like the string you have printed or the record count which query processor through create problem in vba.

    That is why its good practice to suppress this sort of prints by setting nocount on and ansiiwarning off

     

Viewing 13 posts - 1 through 12 (of 12 total)

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