473,803 Members | 3,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic loading of password in connection strings?

I'm a newbie to VB.NET, and so far have used the wizard to generate
connection strings to an Oracle database. In the wizard, the userid
and password are hard coded into the connection string. Is there any
way I can get a userid and password from Windows XP registry, or
dynamically load the userid and password at runtime? If so, how does
one reference a variable in the connection string?
Thanks in advance for your help.
Mark
Nov 21 '05 #1
2 1205
Hi Mark
There is no such thing as variable with in the connection string ( not
like the parameters within the command object ) . What you can do; however
, is to get these values at run time form the user ( or what ever source )
then with them construct the connection string .
For example you can say
Dim user_name As string
Dim connection_stri ng as string
' get the value of the user name in the variable user name
' then construct your connection string
Connection_ stirng = " la blasa adf skjlkjlkjlkj username= " & user_name
& " sdfkjlsdjflksdj f "
'once constructed your string , assign it to the connection string of your
connection objct
Myconection.con nectionString = connection_stri ng
' then open your connection to do your DB job
Hope this helps

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 21 '05 #2
Thank you, Mohamed. I'll give it a try.

mo************@ egdsc.microsoft .com (Mohamoss) wrote in message news:<El******* ******@cpmsftng xa10.phx.gbl>.. .
Hi Mark
There is no such thing as variable with in the connection string ( not
like the parameters within the command object ) . What you can do; however
, is to get these values at run time form the user ( or what ever source )
then with them construct the connection string .
For example you can say
Dim user_name As string
Dim connection_stri ng as string
' get the value of the user name in the variable user name
' then construct your connection string
Connection_ stirng = " la blasa adf skjlkjlkjlkj username= " & user_name
& " sdfkjlsdjflksdj f "
'once constructed your string , assign it to the connection string of your
connection objct
Myconection.con nectionString = connection_stri ng
' then open your connection to do your DB job
Hope this helps

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 21 '05 #3

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

Similar topics

7
3418
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password are input in login screen. The password in the database is a number field. I am writing the dynamic sql statement as follows below. I believe I am going wrong in the password section of the code. I appreciate any help. Thanks. Regards.
1
3976
by: Chris | last post by:
I have a frontend that has some tables which are linked to a backend. Now I want to make the backend password protected and when I try to run it password protected I can't open it. In the first form that opens in the front end, I added the following to the form_open event: Dim cnn As ADODB.connection Set cnn = New ADODB.connection cnn.Provider = "Microsoft.Jet.OLEDB.4.0" cnn.Properties("Data Source") = "C:\backend.mdb"
1
1738
by: andrewcw | last post by:
I get an "Could not find installable ISAM." But the error does not make sense. to me. I converted this code to C# that I found on the internet: ( http://www.vbcity.com/forums/faq.asp?fid=8&cat=MS%20Access#TID42009 ) What might be wrong ? I have a reference to msjro.dll version 2.81.1117.0 which show up as interop.jro in my references. THE FUNCTION: public bool changePassword(string SourceDB,string DestDB,string OldPswd,string...
5
4515
by: Guadala Harry | last post by:
What are my options for *securely* storing/retrieving the ID and password used by an ASP.NET application for accessing a SQL Server (using SQL Server authentication)? Please note that this ID and password would be different than the one the user enters for ASP.NET forms authentication. The ID/password in question is used by the application, itself, for accessing the SQL Server. Thanks in advance.
1
2873
by: stewart | last post by:
I've got the standard SqlCacheDependency working just fine , ie. I've defined (and encrypted) the connectionStrings section in the web.config, and I've also defined an an sqlCacheDependency in the caching section. So, in my code I add an item to the cache with an sqlCacheDependency, referencing the named sqlCacheDependency in the web.config and the database table it is to be based on (have enabled notificiations for that table). Fine. ...
2
2252
by: Matthew Wells | last post by:
Hello, I have an ADO connection object connected to an external ms access password protected database. I am trying to execute a delete statement from that object on a table in my currentdb. Seems strange I know, but I have to do it this way. My currentdb is NOT password protected. When I execute: Delete * from table1 IN "C:\abc.mdb" I get an "Invalid Password" error.
3
3283
by: ryan.mclean | last post by:
Hello everyone, I am wondering, can the membership provider be changed at runtime? Perhaps the connectionStringName? I would like to use a different database based on the server the site is on. I suppose that a custom provider could be used to accomplish this, is there another way?
2
3813
by: =?Utf-8?B?SmVmZnJleQ==?= | last post by:
How to configure the IIS, ASPNET userID, Windows or SQL Authentiation, std or integrated security for SQLserver database? The VS.net 2002 web server and SQL Server client are at the same PC, while the SQL Server database is at another PC. The dataset and DataGrid were created successfully. However, when trying to run a Web Form with a table, a server error msg: Login failed for user '(null)'. Reason: Not associated with a trusted...
9
2987
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I got the core of the javascript from here: http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm I noticed in the demo that sometimes the content takes a long
0
9700
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9564
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
10310
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10292
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
10068
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
6841
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();...
0
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
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
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.