Solved

[VB 2013] Tableadapter Connectionstring

Posted on 2014-09-10
3
153 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now