Solved

[VB 2013] Tableadapter Connectionstring

Posted on 2014-09-10
3
156 Views
Last Modified: 2014-10-10
I have the following problem:

I have a Visual Studio (VB) 2013 project with a datasource. This datasource contains one table.
The project contains two connection strings(conOne and conTwo). I changed the connectionstring (manually in the properties) of the tableadapter to conTwo.

When I start the program the connectionstring it use always conOne.
In this code, it prints always conOne.
 
Dim tba As New dsTableAdapters.tbaTest
        MsgBox(tba.Connection.Database)
        MsgBox(tba.Connection.ToString)

Open in new window


In the properties of the tableadapter it is connection Two.

Please help me. It is very important for us. We use also VS 2008 at this moment and we don't have this problem in 2008.
Anyone know a solution for this problem?
0
Comment
Question by:Program1981
  • 2
3 Comments
 
LVL 41

Expert Comment

by:pcelba
ID: 40315758
Remove the conOne from the project, save the project, rebuild it, and try again. You should see where the conOne was used and then you may replace it by conTwo.
0
 

Author Comment

by:Program1981
ID: 40351603
Yes I did that, it works for a small time.

I have another project with the same problem. No I set all the tableadapter connection strings on each page. It's a solution, but not a good solution.
0
 
LVL 41

Accepted Solution

by:
pcelba earned 500 total points
ID: 40351618
You should connect to your data at one place (one data adapter class) in your code. All other modules/classes should call/instantiate this one data adapter class and problems are gone.
0

Featured Post

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

831 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