|
-
May 29th, 2011, 07:22 AM
#1
Thread Starter
Junior Member
SQL Server Express to developer
Hi, simple question. I am running SQL Server 2008 R2 Express and a vb.net 2008 express application. However, if I were on a computer that has the full SQL Server 2008 developer, and I created a database instance name of SQLEXPRESS. Is it possible I could still connect to the full Server db file with the same connection string (given that I place the .mdf in the same directory on the machine?).
vb Code:
Dim con As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=" & dbfile & ";Integrated Security=True;Connect Timeout=30;User Instance=True")
con.Open()
-
May 29th, 2011, 10:20 AM
#2
Re: SQL Server Express to developer
It's a named server instance... not a database instance... and the only way to create new named instances is to install SQL a second time... I don't recommend this.
Your best bet would be to put the connection string in the config file rather than hard coding it.
-tg
-
May 29th, 2011, 11:00 AM
#3
Thread Starter
Junior Member
Re: SQL Server Express to developer
Thank you. I do not plan to do this myself, but it was more theoretical.
I hope I am understanding you right, and I see you would not recommend doing this, but in theory if one were to install the full SQL Server again, with the instance name of SQLEXPRESS, the current express connection string within the application could be compatible with the non-express server instance on the other machine?
Regarding the config file, I am not sure I follow how that would be my best bet between switching from express and non-express versions of the server.
-
May 29th, 2011, 09:03 PM
#4
Re: SQL Server Express to developer
in theory, yes, you could do that... it's not recommended though.
as for the connection string in the config file, the reason is that it would be easier to change... all you would need to do is change the config file... if you hard code it, then anytime you need to change it, you have to find all the places where it is, change it, and recompile the app.
-tg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|