Solved

Help overriding tableadapter connection string in c#

Posted on 2007-03-26
5
1,311 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

733 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