CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Getting results back from SQL server as text

    Houston, I have a problem. I need to retrieve text from the SQL server. Anyone who has ever worked with Query Analizer must know what I mean. For those who don't (or forgot), I mean the text that is returned when running a statement (like X rows affected). Actually, I'm more after the text that is returned by stored procedures (including generated by the print statement).
    This is because I need to get information about the path the procedure followed. This information is outed with the print statment.
    Also would it be handy to get a real error message instead of '-201354215 method execute of connection failed'

    Thanx

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: Getting results back from SQL server as text

    I dont think there's anyway to get that text like in QA. However, there are at least two other ways i can think of at the moment.

    1) if you added an output parameter to the stored procs, then replaced the PRINT statements with SET @OutBoundVar = @OutBoundVar + 'something else you want to relay' statements - wouldn't that do it?

    2) Insert those "reporting statements" into another table and then issue a SELECT from there - the stored proc can bring back more than one recordset - and you're code can use it if it wants, otherwise, it will just ignore it.

    let me know if you'd like more detail about either of those scenarios.

    john

    John Pirkey
    MCSD
    http://www.ShallowWaterSystems.com
    http://www.stlvbug.org
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured