473,795 Members | 3,323 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TableAdapters and maintaining state?

I store my server and database names in a static class that all
libraries use. Using a config file, I can switch from test, staging,
or production servers easily.

I like what TableAdapters are generated by VS.NET 2005 do. It seems
most everything is there for you. However, because the TableAdapter
controls everything, I'll have to go to each and change the connection
string when I want to switch servers. Or, am I missing something?

Are TableAdapters a good idea for loading non UI objects? In other
words, creating .NET instances of database tables. These objects may
interact with other non UI or UI objects.

Thanks,
Brett

Nov 14 '06 #1
1 1848
Hi Brett,
>I store my server and database names in a static class that all
libraries use. Using a config file, I can switch from test, staging,
or production servers easily.

I like what TableAdapters are generated by VS.NET 2005 do. It seems
most everything is there for you. However, because the TableAdapter
controls everything, I'll have to go to each and change the connection
string when I want to switch servers. Or, am I missing something?
You can change the value of the settings property instead:

Properties.Sett ings.Default["LocalConnectio nStringName"] = "new conn string"

Note: it has to be done using the indexer, not the property.

I like to use conditional compilation for this:

#If !DEBUG
Properties.Sett ings.Default["GlobalConnecti onString"] =
Properties.Sett ings.Default.Re leaseConnection String;
#endif
Are TableAdapters a good idea for loading non UI objects? In other
words, creating .NET instances of database tables. These objects may
interact with other non UI or UI objects.
A table adapter connects to your database, retrieves a single result set and
fills the corresponding DataTable in a Typed DataSet. You can use the filled
DataTable however you'd like. Bind to it from UI elements or pass it to
business objects for processing - It's your choice.

--
Dave Sexton
Nov 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2261
by: leegold2 | last post by:
Probably a newbie question about "state": My problem is I have a search form, so user enters a keyword <enter>, then this form posts to another page were the result are displayed. But this display page uses pagination to break the results up into several subsequent pages. The 1st page is OK, but 2nd...last display pages loose the key word variable I initially posted. Seems I could keep passing the keyword with GET, I already use GET...
0
1502
by: Dinesh Upare | last post by:
Hi, I want to fire events of Datatgrid without maintaining the view state. If I disable the ViewState then the events are not fired. The reason I don't want to maintain view state is because its too heavy when the data increases. Is there any way I only write the ViewState which is required to fire the dataGrid Events? I tried to override the SaveViewState and SavePageStateToPersistanceMedium
1
1923
by: Novice | last post by:
Hey all, I have finally managed to create a Custom WebControl and am using a technique from another programmer to maintain state between pages - I would just like to validate this idea. Basically I have created a Custom Web Control that is capable of generating multiple webpages. It actually only creates one webpage, but hides Panels (that contain the web controls - TextBox's, Labels, etc) to give the impression that the user is...
3
4268
by: Christopher Kimbell | last post by:
I have a class library that contains a number of TableAdapters and I'm using this from a web application. Is there a way of getting the TableAdapters to use the connectionstrings defined in web.config. From the MSDN documentation it seems like it's possible to override settings with values in a config file for winform applications. Is the same possible for web applications. I have tried to add a connectionstring (under the...
7
1390
by: CMM | last post by:
Unless someone has come up with a way, I still don't understand how you can use TableAdapters in a true n-tier infrastructure.... where the DataAccessLayer is in one Dll and *only* the Datasets themselves can be shared across layers. I find it inconceivable that this suggestion http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=d2907b53-885b-4d24-bc9c-1a04d76036e4 (that's not me who suggested it) has been marked...
0
1320
by: mark.norgate | last post by:
Hi I'm having a problem in adding controls to a page programmatically in response to a button click. Composite user controls added programmatically in the CreateChildControls() method work fine; they maintain their state as expected. Cool and groovy. However, since CreateChildControls() is called before the method that responds to the button click, say AddControl_Click(), for some reason, this control does not maintain its
4
4344
by: Sam | last post by:
I have an asp.net 2.0 app that uses a sitemap, Master Page, and has several content pages. While this feature has simplified the process of creating a data-driven site menu, it does seem to have some big restrictions. Namely, maintaining state on the Master Page across all content pages. I simply want to keep track of a key value across all content pages. The only solution I can come up with is using a session variable, which I hate.
2
1876
by: Steve Kershaw | last post by:
I have a need to extract data from an Oracle database using an SQL query. The problem is that I need to insert a parameter into the query. For example: SELECT EMPLOYEE, DED_CODE FROM QUARTDED WHERE STATE = @STATE The problem is that the "@STATE" Dosen't work. When I try to execute the query in Query Builder I get a Invalid column error. Further the query changes from WHERE STATE = @STATE to WHERE STATE =
7
2494
by: =?Utf-8?B?R3JlZw==?= | last post by:
When using the VS Wizards to create a DataSet I select tables. Then, I use the TableAdapter Configuration Wizard to modify the underlying queries that retreive the data. What I'm wonder is, does this TableAdapter work in the same manner as a SQL Server Stored Procedure or View? Or, does it work like MS Access where it pulls all the data over and then filters it? Or, should I be making my data sources for the TableAdapters stored...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10213
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.