Click here to Skip to main content
15,885,546 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: change connection with database on runtime Pin
Dave Kreskowiak15-Mar-14 10:01
mveDave Kreskowiak15-Mar-14 10:01 
GeneralRe: change connection with database on runtime Pin
alejx15-Mar-14 11:29
alejx15-Mar-14 11:29 
GeneralRe: change connection with database on runtime Pin
Dave Kreskowiak15-Mar-14 12:11
mveDave Kreskowiak15-Mar-14 12:11 
GeneralRe: change connection with database on runtime Pin
alejx16-Mar-14 6:06
alejx16-Mar-14 6:06 
GeneralRe: change connection with database on runtime Pin
Dave Kreskowiak16-Mar-14 7:25
mveDave Kreskowiak16-Mar-14 7:25 
GeneralRe: change connection with database on runtime Pin
alejx16-Mar-14 8:35
alejx16-Mar-14 8:35 
GeneralRe: change connection with database on runtime Pin
Dave Kreskowiak16-Mar-14 14:15
mveDave Kreskowiak16-Mar-14 14:15 
GeneralRe: change connection with database on runtime Pin
alejx17-Mar-14 5:32
alejx17-Mar-14 5:32 
Thank you !
This is my code for changing the connection String :
C#
Dim connstringtemplate As String = System.Configuration.ConfigurationManager.ConnectionStrings(1).ConnectionString.ToString

 Cnstring = connstringtemplate.Replace("{DATABASE}", "MyDB2")


This is My partial class
VB
Partial Public Class MyEntities
    Inherits DbContext

    Public Sub New(connectionString As String)
        If String.IsNullOrWhiteSpace(connectionString) Then
            Throw New ArgumentNullException("connectionString")
        End If

        Database.Connection.ConnectionString = connectionString
    End Sub


Entity declaration :
context = New MyEntities(cnstring)


But now on runtime i get an error on the line
Database.Connection.ConnectionString = connectionString

An unhandled exception of type 'System.ArgumentException' occurred in System.Data.dll

Additional information: Keyword not supported: 'metadata'.

GeneralRe: change connection with database on runtime Pin
alejx18-Mar-14 4:56
alejx18-Mar-14 4:56 
GeneralRe: change connection with database on runtime Pin
Dave Kreskowiak18-Mar-14 5:44
mveDave Kreskowiak18-Mar-14 5:44 
GeneralRe: change connection with database on runtime Pin
alejx18-Mar-14 6:16
alejx18-Mar-14 6:16 
GeneralRe: change connection with database on runtime Pin
Dave Kreskowiak18-Mar-14 11:13
mveDave Kreskowiak18-Mar-14 11:13 
GeneralRe: change connection with database on runtime Pin
alejx18-Mar-14 12:50
alejx18-Mar-14 12:50 
GeneralRe: change connection with database on runtime Pin
Dave Kreskowiak18-Mar-14 13:31
mveDave Kreskowiak18-Mar-14 13:31 
GeneralRe: change connection with database on runtime Pin
alejx18-Mar-14 14:35
alejx18-Mar-14 14:35 
QuestionCopy scanned files Pin
Otekpo Emmanuel12-Mar-14 13:59
Otekpo Emmanuel12-Mar-14 13:59 
AnswerRe: Copy scanned files Pin
Rage12-Mar-14 22:19
professionalRage12-Mar-14 22:19 
QuestionURGENT HELP NEEDED : DB2 Connection failed in Visual Basic 6.0 Pin
Senthilkumar E10-Mar-14 8:33
Senthilkumar E10-Mar-14 8:33 
AnswerRe: URGENT HELP NEEDED : DB2 Connection failed in Visual Basic 6.0 Pin
Eddy Vluggen10-Mar-14 9:56
professionalEddy Vluggen10-Mar-14 9:56 
GeneralRe: URGENT HELP NEEDED : DB2 Connection failed in Visual Basic 6.0 Pin
Senthilkumar E11-Mar-14 4:08
Senthilkumar E11-Mar-14 4:08 
QuestionRe: URGENT HELP NEEDED : DB2 Connection failed in Visual Basic 6.0 Pin
Eddy Vluggen12-Mar-14 1:28
professionalEddy Vluggen12-Mar-14 1:28 
AnswerRe: URGENT HELP NEEDED : DB2 Connection failed in Visual Basic 6.0 Pin
Dave Kreskowiak11-Mar-14 4:51
mveDave Kreskowiak11-Mar-14 4:51 
QuestionHow to exempt a text box from being filled Pin
Diepriye10-Mar-14 7:42
Diepriye10-Mar-14 7:42 
AnswerRe: How to exempt a text box from being filled Pin
Richard MacCutchan10-Mar-14 7:49
mveRichard MacCutchan10-Mar-14 7:49 
GeneralRe: How to exempt a text box from being filled Pin
Diepriye10-Mar-14 7:54
Diepriye10-Mar-14 7:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.