Solved

Help overriding tableadapter connection string in c#

Posted on 2007-03-26
5
1,314 Views
Last Modified: 2012-05-05
I am trying to override the default connection string in a table adapter with a string that gets built using the connectionstringbuilder

            SqlConnection c = ConnStrBuilder.BuildConnection(orgid);
            tvEventLocationsPlusNamesTableAdapter tvELNByEventAdapt = new tvEventLocationsPlusNamesTableAdapter();
            tvELNByEventAdapt.Connection = c;

This little snippet is what my current code is but it returns an error because the tvELNByEventAdapt doesnt contain a definition for 'Connection'.

What is  the correct way for me to override the default connection string for the table adapter so that its using the correct connection string?

0
Comment
Question by:Prysson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 18798258
i think u will have to do

tvELNByEventAdapt.SelectCommand.Connection = c;

si,ilarly for inserte, update and delete commands
0
 

Author Comment

by:Prysson
ID: 18799122
THat just gives me the same error about not containing a definition.

0
 

Accepted Solution

by:
Prysson earned 0 total points
ID: 18799401
Never mind the problem was that the adapter was hosed. I recreated teh adapter and my code works fine now.

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

705 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