Results 1 to 4 of 4

Thread: SQL Server Express to developer

  1. #1
    Junior Member
    Join Date
    Dec 10
    Posts
    30

    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:
    1. Dim con As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=" & dbfile & ";Integrated Security=True;Connect Timeout=30;User Instance=True")
    2.             con.Open()

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 02
    Posts
    21,636

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    *Proof positive that searching the forums does work: View Thread *
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *
    * Use Offensive Programming, not Defensive Programming. * On Error Resume Next is error ignoring, not error handling(tm).
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN

  3. #3
    Junior Member
    Join Date
    Dec 10
    Posts
    30

    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.

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 02
    Posts
    21,636

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.-I also subscribe to all threads I participate, so there's no need to pm when there's an update.*
    *Proof positive that searching the forums does work: View Thread *
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *
    * Use Offensive Programming, not Defensive Programming. * On Error Resume Next is error ignoring, not error handling(tm).
    "There is a major problem with your code, and VB wants to tell you what it is.. but you have decided to put your fingers in your ears and shout 'I'm not listening!'" - si_the_geek on using OERN

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •