?
Solved

Programmatically Change Connection String in Data Access Layer

Posted on 2011-10-15
6
Medium Priority
?
262 Views
Last Modified: 2012-05-12
I'm providing snapshots - hopefully it will help.  I have picked up an application from another developer.  The connection string was put in the DAL.  I have a requirement to change the connection string per HIPPA laws.  There are two connection strings in the webconfig file.

To make it easy - when the user logs in the first connection string needs to be used and passed to the DAL.  After login I need to pass the second connection string to the DAL and use it.

I put a breakpoint in the DAL.Setup but it does not stop and I receive an error in the Login Class.

Any idea?
LoginPage.jpg
Login-Class-Step-Through.jpg
Login-Class-Error.jpg
DAL-001.jpg
DAL-002.jpg
DAL-Util-Class.jpg
DataProvider-Class.jpg
0
Comment
Question by:CipherIS
  • 3
  • 2
6 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 36974890
You've got a private variable _connstr which holds the connection string, why not create a public function that would allow you to pass in a new connection string? Perhaps:

Public Sub SetConnectionString(ByVal newConString As String)
    Me._connstr = newConString
End Sub

Open in new window


You call this as needed in the code outside of your DAL.
0
 
LVL 1

Author Comment

by:CipherIS
ID: 36974959
didn't work
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 36974973
Perhaps you could elaborate on what you did exactly?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LVL 14

Expert Comment

by:nishant joshi
ID: 36975004
DAL ???  is it table adapter...?
0
 
LVL 1

Accepted Solution

by:
CipherIS earned 0 total points
ID: 36976046
I resolved it.  I made the method a shared method and the variables a shared method

0
 
LVL 1

Author Closing Comment

by:CipherIS
ID: 37005098
I resolved it.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
There is a wide range of advantages associated with the use of ASP.NET. This is why this programming framework is used to create excellent enterprise-class websites, technologies, and web applications.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Suggested Courses

607 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