Page 1 of 1

Hand connectionstring over instead of web.config

Posted: Fri 20 Feb 2009 15:55
by matthias.max
Hi,

I have an ASP.Net projewct with a DataContext created with dotConnect.
The created class autom. fetches its connection info out of the web.config where it looks like this:

Code: Select all

    

    

How can I set the connection string programmatically in Visual Basic?
If I copy that string into a String variable I get an error. Even if I replace the " with chr(34).

Thanks!

Posted: Tue 24 Feb 2009 08:41
by AndreyR
You can use a code like the following:

Code: Select all

Dim db As New Entities("metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=Devart.Data.Oracle;provider connection string=""User Id=***;Password=***;Server=***;Persist Security Info=True""")