473,503 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Probably s Simple Question but ....

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
Nov 21 '05 #1
1 1057
Hi,

I would do it this way.

Dim conn As SqlConnection

strConn = "Server = " + Environment.MachineName + "\VSdotNet;"

strConn += "Database = NorthWind;"

strConn += "Integrated Security = SSPI;"

conn = New SqlConnection(strConn)

Ken
-----------------
"Wizard" <Wi****@Wizard.com> wrote in message
news:Mp********************@karoo.co.uk...
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

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
318
by: LeROY | last post by:
I need to output some related data tables as XML. I have my data adapters and my dataset with the relations defined. It is certainly simple enough to use the dataset.WriteXML function. However,...
4
1418
by: Tomas Machala | last post by:
Hi, I'm trying to make an application communicating over TCP/IP. It should do only one thing - write received data to console and terminate itself when "exit" received. Problem is that if I send some...
2
991
by: matt7124 | last post by:
I use Visual C++.NET 2003. I've been reading an older book on C++. One program example shows how to make a simple window and draw a rectangle inside it. At the beginning, they include the...
30
1786
by: Brian Elmegaard | last post by:
Hi, I am struggling to understand how to really appreciate object orientation. I guess these are FAQ's but I have not been able to find the answers. Maybe my problem is that my style and...
2
1426
by: ApexData | last post by:
Hello I'm sure the solution is simple and probably has something to do with the VB Editor. I want to create an EventProcedure link to an already created procedure that exists in my Form...
3
1883
by: Rangy | last post by:
Hi, I've decided to take the plunge and move from tables to a pure css layout. I still "think" in tables when I do my layouts and I was wondering the following: I have a simple, standard two...
7
1658
by: Dustin MacDonald | last post by:
Hi everyone. This is my first time posting to this newsgroup, and although I maintain my netiquette I might've missed something specific to the newsgroup, so hopefully you can avoid flaming me...
0
1105
by: dengel | last post by:
I'm a classic ASP/VbScript user, transitioning to c# and .NET. I'm making a little PW change utility which does this: 1. User inputs an email address/username (into a textbox) 2. User inputs...
3
1299
maxx233
by: maxx233 | last post by:
Hello, I'm developing a simple program to control a video switcher we have via RS232. All the backend control stuff is figured out just fine, the interface is what's giving me problems! I'm...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.