?
Solved

sql directory

Posted on 2002-03-12
9
Medium Priority
?
153 Views
Last Modified: 2012-05-04
how do i get the sql directory..?
(e.g. c:\mssql)
0
Comment
Question by:killer5
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 6859763
Hi killer5, you could try the registry under the following key

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Setup

The actual executables will be in "Binn" under the directory specified at this key.

HTH:O)Bruintje
0
 
LVL 1

Author Comment

by:killer5
ID: 6859769
how do i get the SQL directory thru VB?
0
 
LVL 3

Expert Comment

by:Rem
ID: 6859823
As bruintje said, read the registry.
you'll need some declarations like:
Option Explicit

Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long         ' Note that if you declare the lpData parameter as String, you must pass it By Value.

Then you'll need a function to open, read and close the registry. For the reading part, something like:
        lngResult = RegOpenKeyEx(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Setup)

Play around with these api calls. Very helpful.

Bye

Rem
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 44

Accepted Solution

by:
bruintje earned 20 total points
ID: 6859832
and of course you could take a look at essentially the same sort of code including a complete get key function at

http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=10479&lngWId=1

:O)Bruintje
0
 
LVL 3

Expert Comment

by:Rem
ID: 6859846
Jeez Bruintje, I just woke up, don't ask too much. LOL

I just stripped a bit from my own old stuff looking up the ODBC.INI and changed the string to the one you mentionned.
0
 
LVL 1

Author Comment

by:killer5
ID: 6859908
i don't wanna play around... i'ma  lazy person

can someone give me a function that will search for the SQLPath value in the registry?
0
 
LVL 3

Expert Comment

by:Rem
ID: 6859923
The link bruintje provided gives you what you asked for.
This site is to help people having a specific problem. If you want other people to do your work, or do complete projects, my guess is that you're not on the right website.
Experts gave you what you asked for. So please read the EE guidelines.
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6861237
Grade changed.

killer5,

Laziness on your part is no excuse for not rewarding Experts for their assistance, especially when you add questions to the original question without adding points.

Netminder
Community Support Moderator
Experts Exchange
0
 
LVL 44

Expert Comment

by:bruintje
ID: 6861255
;) thanks netminder
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

771 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