Solved

Check if Sql Server exist

Posted on 2004-09-01
8
214 Views
Last Modified: 2013-11-14
Hi ,
i'm an access programmer
how i could check MSDE is installed and sql sever exist

every suggestion will be appriciated
0
Comment
Question by:ppk54ir
  • 3
  • 2
8 Comments
 
LVL 3

Accepted Solution

by:
IceColdas earned 125 total points
ID: 11951185
oh, simply put the connection code in a try catch
so u dont need to search for further ways to see if the database exists
try {
        //connect to data base
}
catch (Exception exc)
{
   ShowMessage(exc.Message)
}
0
 

Assisted Solution

by:Spansule
Spansule earned 125 total points
ID: 11952839
It kind of depends on what you're up to, and what language you're using. Here's a snippet of C# code that will retrieve a list of all the SQL Servers available for connection:

// This part retrieves a list of all of the available SQL Servers that can be connected to
SQLDMO.Application sql = new SQLDMO.ApplicationClass();
try
{
      SQLDMO.NameList servers = sql.ListAvailableSQLServers();
      IEnumerator ServerEnumerator = servers.GetEnumerator();
      while (ServerEnumerator.MoveNext())
      {
            // Do stuff with ServerEnumerator.Current;
      }
}
finally
{
      System.Runtime.InteropServices.Marshal.ReleaseComObject(sql);
      sql = null;
}

Otherwise you can use the registry to find out what versions of SQL Server are installed. Try the following key:

HKLM\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion\CurrentVersion

This post lists some other keys to check for different versions of SQL Server: http://www.dotnet247.com/247reference/msgs/55/277144.aspx

You can also identify which MSI was used for installation: http://support.microsoft.com/?kbid=311762

0
 

Expert Comment

by:Spansule
ID: 12162126
I just noticed that he said he was an Access programmer. My comment probably didn't make too much sense in that context then.

I don't have any issues with the topic being closed.
0
 
LVL 3

Expert Comment

by:IceColdas
ID: 12177667
Actually this is exactly what he said :
Hi ,i'm an access programmer
how i could check MSDE is installed and ### sql ### sever exist
Probably got his answer and accepted none
0
 

Expert Comment

by:Spansule
ID: 12179524
LOL maybe I read it right the first time.

In that case I think my answer was pretty good. :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 103
Eclipse Neon start with Admin account only 6 96
PHP question(s) about order of output 9 57
Turning python script into an applet 12 106
Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now