jdsurgeon 0 Newbie Poster

this should connect my datacontext to the new connection string but for some reason it does not work not sure is there a better was to do this. This is a WCF service also.

dim db as new theradatacontext

 Public Function connect_db(ByVal server As String) As Boolean Implements IKattservice.connect_db

        Dim connstr As String = ConfigurationManager.ConnectionStrings(server).ConnectionString

        Try
            db.Connection.Close()
            db.Connection.ConnectionString = connstr
            db.Connection.Open()
            Return True
        Catch ex As Exception
            Return False
        End Try

    End Function