Running the prog in a network environment RRS feed

  • Question

  • Hi Every one,

       If any one can help, I made a programme for my org in a simple form. Basically I used my data base as mdf in Bisual Studio 2008. Which operates in a stand alone computer. Now I am in a situation that I need to run the prog in a network.  When I tried to make the prog using SQL data base it only operates in the computer where it is built. whenever I load it to any other computer it says it could not find the database it requires. It will be appriciated if any one can give a easy solution to the problem.

    Thanks in advance
    Tuesday, November 3, 2009 3:02 PM

All replies

  • Probably one of these 3

    - Make sure Remote Connections are enabled.
      "How to: Check and Set Remote Server Connection Options (SQL Server Management Studio)"

    - Make sure firewall is setup correctly.
      "How to: Configure a Windows Firewall for Database Engine Access"

    - Make sure SQLBrowser service is running, otherwise only IP address will work.
      "SQL Server Browser Service"


    This posting is provided "AS IS" with no warranties.
    Tuesday, November 3, 2009 4:14 PM
  • Hi Michaele,

       You have given me some links to find solution to my problem. It is difficult for me to comprehend as I am new to this business. Let me explain my situation what I have done. I used Visual Studio 2008. Initially, I made a database using SQLExpress which was like this .\SQLEXPRESS, the connection String is shown below, then I made the Data table and built my software name "Air Crew DataBase" I Deployed,  took it to another computer and installed. While running it does not get the database to show.  Afterwards I changed the database to local database as "mdf" which I am able to run installing in different computers but, in every computer I have to insert new record seperately.  My requirement is can you give me any kind of suggestion though which I can operate my software having the same database in 3-4 different computers in a network. Which means I don't want to individually insert the same records in  defferent computers to show.  Help will be appritiated. Thanks


    This is in SQL DataBase

    Data Source=.\SQLEXPRESS;Initial Catalog=AirCrewDatabase;Integrated Security=True;Pooling=False

    Below is built in Local database

    Data Source=.\SQLEXPRESS;AttachDbFilename=E:\VB2008Practice\BSR_MT\BSR_MT\BSR_MT\BSRVehDatabase.mdf;Integrated Security=True;User Instance=True

    Wednesday, November 4, 2009 1:11 PM
  • Hi WasekMajlis,


    For connecting MDF file remotely, you can refer to the following two option:


    1.    Place the database at a network PC, then connect it via UNC path:

    Dim con As New SqlConnection("Data Source=.;Integrated Security=True;AttachDbFilename=\\ ServerAddressOrName\Share\DBname.mdf")


    2.    Attach the database onto SQl Server Management Studio, then via the following connection string:

    Dim con As New SqlConnection("Data Source=ServerAddress;Initial Catalog=DBname;User Id=myUsername;Password=myPassword;")



    Here are connection strings for SQL Server 2005  http://www.connectionstrings.com/sql-server-2005




    Best Regards

    Yichun Feng

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Sunday, November 8, 2009 2:49 AM
  • Hi Michaele,

      Not very much confident. Need step by step assistence.  What do you mean by  "Place the database at a network PC, then connect it via UNC path" please explain.  and what is UNC? where do I write all these connection strings. Thanks

    Monday, November 9, 2009 2:38 PM
  • I don't know where Mr. Feng got his information but any database file that SQL Server (any edition) accesses must be located on the physical system where it's accessed--not somewhere on a network share. This works (terribly) with an Access or SQL Compact database but not for SQL Server. 

    So, to your problem. SQL Server Express was designed to work with either dynamically attached (physically local) databases or to database files permanently attached to the SQLEXPRESS instance. The ConnectionString your're using
    Data Source=.\SQLEXPRESS;AttachDbFilename=E:\VB2008Practice\BSR_MT\BSR_MT\BSR_MT\BSRVehDatabase.mdf;Integrated Security=True;User Instance=True

    does the former. However, it's also assuming that the local user is going to access it. This is NOT how you setup a shared server datatabase--it will never work correctly.

    This means you'll need to permanently attach the .MDF database to the SQLEXPRESS instance and access it without USER INSTANCE=True. Simply put, a connection string like this should work from any of the client applications (assuming you've setup SQL Server Express correctly):

    "Data Source=YourServer\SQLEXPRESS;Inital Catalog=MyDatabaseName;Integrated Security=SSPI"

    See Chapter 9 of my book "Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)". It was written specifically for you...

    William (Bill) Vaughn -- Mentor, Author, Dad and MVP
    Saturday, February 20, 2010 4:03 AM