This page has moved. You will be automatically redirected to its new location in 10 seconds. If you aren't forwarded to the new page, click here.

Search This Blog

Tuesday, March 10, 2009

Modifying Connection String dynamically for a strongly typed dataset in a different assembly

http://jagchat.spaces.live.com/blog/cns!41050F68F010A662!1223.entry

Private Sub MySettings_SettingsLoaded(ByVal sender As Object, ByVal e As System.Configuration.SettingsLoadedEventArgs) Handles Me.SettingsLoaded
            Dim s As MySettings = TryCast(sender, MySettings)
            s.Item("SampleConnectionString") = System.Configuration.ConfigurationManager.ConnectionStrings("cnDev").ConnectionString 
        End Sub

SampleConnectionString is local in the DAL class library project

cnDev is in the web.config of the actual project

Both should have same names.

No comments:

Post a Comment