473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Change Connection string for designer table at runtime

I'm new to C# development. I am familiar with setting up connection strings and working with databases in ADO in VB6, but this is a bit more involved.

I have a very basic application in which I created a connection to a production database table with three fields. I drug the table onto the form and was pleasantly surprised to see how it not only created the table on the form, but also gave me navigation controls. Unfortunately, now I want to add a toolbar button that allows the user to switch between the production and testing databases by changing the connection string, clear the contents of the cells, and refill them with the information from the new string.

My plan was very basic, using a messagebox. If the dialog result was OK, select the production database. If Cancel, select the test database. In the method to handle the button click, I got so far as to have the If..Else statement after getting the dialog result, but for the life of me, I can't find a way to change the string for the connection string.

Bear with me as I'm very new to C#. Any links/help would be appreciated.
Mar 15 '10 #1
0 1587

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: ST | last post by:
This is my other error when I click on Immunoflourescence. I believe this is related to the other error I just posted (Input string was not in a correct format.) Please let me know if you have...
7
by: Henry | last post by:
I am writing a Windows forms VB.Net/MS SQL application via VS 2003 that utilizes Crystal Reports. I want to be able to dynamically set the report data source at run time. I'm trying to change...
2
by: Tim Frawley | last post by:
I am attempting to change the ODBC Link Provider String in an Access database linked to an Oracle server using ADOX in VB.NET. I created some code using the example from post:...
3
by: paulo | last post by:
Hello, I'm developing a web services apllication using SQL Server in mixed mode. I'm also using WSE 3.0. For each user in the application there's a corresponding user on the database. The...
0
by: zeng.hui.stephen | last post by:
I download the demo http://msdn.microsoft.com/msdnmag/issues/02/10/cuttingedge/. I inherite the demo, and write my code. I want to use Hook to monitor C++ Edit change. I use a C# form...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
7
by: harry | last post by:
I've set my database connection as an Application.Setting using the designer. Since Application.Settings are read only, how do I change the connection properties when deploying to another...
0
by: Matt MacDonald | last post by:
Hi All, When using the dataset designer, at least once a week or so, I will try to add a new query to a table adapter, or modify an existing one and get the error "Unable to find connection...
1
by: =?Utf-8?B?cmFuZHkxMjAw?= | last post by:
In the Visual Studio 2005 designer, I have a grid, a binding source, and a data set which contains two data tables. In the Designer, I make the settings below. If I set the DataMember for the...
0
by: silpa | last post by:
Hi, I am doing a sample VS 2008 project. I have added a dbml file.On the designer,I have dragged a table "emp" from a database "Employee" which is in my server(for example Server1). It...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...
0
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,...

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.