Hey Group,
Im having some major trouble trying to find info on this one:(
Wonder if somebody could possibly help?
At Present I can get this working:
Private Sub frmSystemOptions_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim RegKeyRead As RegistryKey
'Reset the resulting textbox
txtSQLSRVNAME.Text = ""
'Try to open the given path
RegKeyRead = Registry.CurrentUser.OpenSubKey("Software\Program" , True)
If RegKeyRead Is Nothing Then
'If the path doesn't exist, warn the user
MessageBox.Show("key not found!")
Exit Sub
End If
'Retrieve the subkey and its value (alone with a default value if the subkey
is not found)
txtSQLSRVNAME.Text = RegKeyRead.GetValue("CompanyName", "----Not
Found----").ToString
'Close the key
RegKeyRead.Close()
End Sub
Alworks Fine, Show`s in my textbox etc, etc.
Here is my SQL connect sring:
Dim oSQLConn As SqlConnection = New SqlConnection()
oSQLConn.ConnectionString = "Data Source=SQLSRVNAME;" & "Initial
Catalog=myDatabaseName;" & "Integrated Security=SSPI"
oSQLConn.Open()
I would like to build my SQL connect sting so that it looks at the registry
key and uses that as the PC name for the database?
Anybody help me with the code?
Many Thanks
Wizard
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.791 / Virus Database: 535 - Release Date: 08/11/2004