473,657 Members | 2,537 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 frmSystemOption s_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim RegKeyRead As RegistryKey
'Reset the resulting textbox
txtSQLSRVNAME.T ext = ""
'Try to open the given path
RegKeyRead = Registry.Curren tUser.OpenSubKe y("Software\Pro gram", 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.T ext = RegKeyRead.GetV alue("CompanyNa me", "----Not
Found----").ToString
'Close the key
RegKeyRead.Clos e()
End Sub

Alworks Fine, Show`s in my textbox etc, etc.

Here is my SQL connect sring:

Dim oSQLConn As SqlConnection = New SqlConnection()
oSQLConn.Connec tionString = "Data Source=SQLSRVNA ME;" & "Initial
Catalog=myDatab aseName;" & "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 1074
Hi,

I would do it this way.

Dim conn As SqlConnection

strConn = "Server = " + Environment.Mac hineName + "\VSdotNet; "

strConn += "Database = NorthWind;"

strConn += "Integrated Security = SSPI;"

conn = New SqlConnection(s trConn)

Ken
-----------------
"Wizard" <Wi****@Wizard. com> wrote in message
news:Mp******** ************@ka roo.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 frmSystemOption s_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim RegKeyRead As RegistryKey
'Reset the resulting textbox
txtSQLSRVNAME.T ext = ""
'Try to open the given path
RegKeyRead = Registry.Curren tUser.OpenSubKe y("Software\Pro gram", 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.T ext = RegKeyRead.GetV alue("CompanyNa me", "----Not
Found----").ToString
'Close the key
RegKeyRead.Clos e()
End Sub

Alworks Fine, Show`s in my textbox etc, etc.

Here is my SQL connect sring:

Dim oSQLConn As SqlConnection = New SqlConnection()
oSQLConn.Connec tionString = "Data Source=SQLSRVNA ME;" & "Initial
Catalog=myDatab aseName;" & "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, this writes the data such that each DataTable in the dataset is written one after the other. This is not what I need. I do not need to be able to load this back into a dataset at a later time. The XML file and schema I generate will be used to...
4
1428
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 string to this application, it'll receive that string and many unwanted "new line" characters on its end. Examle: If I send "some_string" application display
2
997
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 statement: #include "rect.h" to include the corresponding library. But when I build, the compiler doesn't recognize "rect.h" as a library. What is the problem?
30
1805
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 understanding are influenced by matlab and fortran. I tried with the simple example below and ran into several questions: 1: Why can't I do: def __init__(self,self.x):
2
1437
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 Code. I plan to use this procedure more than one time. I can't figure out how to get OnUpdate to reference or PointTo this procedure. I keep creating and making a reference in the editor to a
3
1890
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 column layout: header nav content
7
1663
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 if I have :) I apologize for the length of this post but I figure the more information the better. My problem is that I'm getting a syntax error in some Python code that looks quite simple. The original code was in Object Pascal as I'm a
0
1114
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 their current Password(into a textbox) 3. User presses a submit button 4. Server checks the value of the text in the currentPassword textbox against the user's stored password in the DB. If they don't match, then it displays an error. 5. Else, a...
3
1304
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 basically just trying to figure out how to light up buttons depending on how they logically refer to each other, and I'm certain it should be simple, but I feel like I'm going in circles on it and getting nowhere... What I want is a column of buttons on...
0
8303
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8502
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8602
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7316
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
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 we have to send another system
2
1941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.