Hi George,
As for the TypedDataSet(in class library project)'s connectionstring
problem, it is a common question I've seen. Actually, you can override the
connectionstring in your consumer application(asp.net or other desktop)'s
app.config file.
For example, in your class library, when you created type dataset, it will
generate the following section in the class library's app.config file:
===============
<connectionStrings>
<add
name="ClassLibrary1.Properties.Settings.MYASPDBConnectionString"
connectionString="Data Source=localhost;Initial
Catalog=MYASPDB;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
===============
this is generated by the IDE for your typedataset. You can try adding such
a connectionstring entry in your calling application( the asp.net )'s
app.config file to override the default value(compiled in class library
assembly).
here are some former threads where I've mentioened something else about
such customziation of class library's project properties:
#app.config
http://groups.google.com/group/microsoft.public.dotnet.general/browse_thread
/thread/cba21e1cfca4585a/d3b4969cae7a600e
#Question on how to manage SQL Server connection string Options
http://groups.google.com/group/microsoft.public.dotnet.framework.webservices
/browse_thread/thread/e8b06265ba1c2b33/3c2a56cc046e4b1c
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: =?Utf-8?B?TWF4R3J1dmVu?= <
[email protected]>
References: <
[email protected]>
Subject: Re: Typed DataSet in DLL points to wrong database!
Date: Thu, 5 Jun 2008 15:41:02 -0700
Where do I put the reference to connection string in the BL/DL Assembly?
Does it go in Project/Properties/Settings or app.config or in code somewhere?
AND
What Connection String gets used when just working on the BL/DL Assembly
when there is no website (during development)??
TIA,
George
Peter Bromberg said:
Since each web site would have its own web.config, set up the connection
string in the <connectionStrings... element
in the Assembly, you would get the proper connection string with:
ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;
Your assembly would need to have a reference to System.Configuration.
Peter
I have a DLL that implements the Business and Data Layers for a number of
different websites. That DLL uses a Strongly Typed DataSet to interface
to
the Data Source which is SQL Server.
There is a connection string in the DLL that is causes me grief. It
points
at a particular instance of database. I hae to recompile the DLL for each
WebSite.
How can I re-use that DLL on different websites and have it point to
different instances of the Database without recompiling it?? Perhaps
configurable in Web.Config??
TIA,
George