Results 1 to 7 of 7

Thread: VB6 - Know if MSSQLS is running, restart MSSQLS (...)

  1. #1

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192

    Lightbulb VB6 - Know if MSSQLS is running, restart MSSQLS (...)

    I was checking the forums for a way to find out if MSSQL Server was running and a way to know how to start MSSQL Server... Why? So I could start it if it was stopped.

    As you can imagine, I didn't find any way at all, but I found a lot of questions about how to do it and none of them had an answer. So I took my time, found an approach to do it and now I would like to share it. Here is a list of what you can do with the module modSQLServerCmd:

    1.- Know if MSSQL Server is running
    2.- Start MSSQL Server
    3.- Restart MSSQL Server
    4.- Start MSSQL Server if MSSQL Server is not running

    In the attached project you can find a status picture that gives you the sensation of using the Service Manager and an example of how to use some of the features listed before.

    Yes, all of these functions will take some time to be executed... Why? Well, they all have to wait on the results and thus they depend on how long it takes MSSQL Server to respond.

    Feel free to comment about it. If you have a better way to do this, please share it with all of us...
    Attached Files Attached Files
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  2. #2
    New Member
    Join Date
    Sep 2005
    Posts
    10

    Re: VB6 - Know if MSSQLS is running, restart MSSQLS (...)

    thanks man this a really good code

    Initially i thought that the code execution is a bit slow but later reallized that masqlserver takes some time to start

  3. #3

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192

    Re: VB6 - Know if MSSQLS is running, restart MSSQLS (...)

    It is nice to see people are taking a look at this code... You are welcome, nikhilj1.

    If anyone else finds this code useful and would like to add points to my reputation, it would be nice. Don't feel obligated, though, helping someone else is always the best satisfaction one can get.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  4. #4
    Addicted Member
    Join Date
    Jan 2006
    Posts
    247

    Re: VB6 - Know if MSSQLS is running, restart MSSQLS (...)

    Pretty good stuff, though I will probably never use it, but definatly worth using if you do some MSSQL development.

    Good Code!

  5. #5

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192

    Re: VB6 - Know if MSSQLS is running, restart MSSQLS (...)

    Thank you very much for your comments, Seraphino.

    I hope it helps everyone doing MSSQL Server development, it sure has helped me all this time.

    Oh, and feel free to rate the original post if you found it useful.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  6. #6
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359

    Re: VB6 - Know if MSSQLS is running, restart MSSQLS (...)

    I like the idea, but unfortunately it's a little crude... Why don't you do some Process Enumeration to check if the SQL Server Process is active and running?
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: VB6 - Know if MSSQLS is running, restart MSSQLS (...)

    Woah... it is a bit crude indeed.... did you check out SQLDMO? It's got all that built right into the objects...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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