Re: Changing a connection string for a TableAdapter

Stacey Levine <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <A48E95FB3D4D02449554AE952F3B3E4702FC4356@vmcexchng.www.musicforasong.net>
Is your adapter already open to the other database? 

Thanks.
 
Stacey
-----Original Message-----
From: Discussion of building .NET applications targeted for the Web
[mailto:[email protected]] On Behalf Of Stephen G. Maczko
Sent: Tuesday, March 13, 2007 7:31 PM
To: [email protected]
Subject: [DOTNET-WEB] Changing a connection string for a TableAdapter

I have the following code:

    Public Function GetClerkshipEnvironmentByID(ByVal nID As Integer) As
CLSClerks2005.DAL.ApplicationProcedureViewDataSet.dalsp_ApplicProcViewDa
taTa
ble

        'Dim oConn As String =
System.Configuration.ConfigurationManager.ConnectionStrings.Item("ClsSur
veyI
nstance").ConnectionString
        Dim oConn As String =
System.Configuration.ConfigurationManager.ConnectionStrings.Item("ClsCle
rksI
nstance").ConnectionString
        Me.Adapter.Connection.ConnectionString = oConn
        Return Me.Adapter.GetData(nID)
    End Function

Actually I'm trying to generate an error--the database that the
"ClsClerksInstance" points to is the wrong instance! But I still get the
page to display the data coming out of this TableAdapter. If that means
I
can't change the connections string in this way, then can anybody
suggest
how it's done?

Steve

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.