none
Linq to SQL DataContext wont point to remote SQL Database connectionString RRS feed

  • Question

  • Hello guys and girls

    I have a Windows Service running which receives information over a socket from a 3rd party provider. The services calls methods in my BLL (DLL) which in turn does data operations on the DBML placed in my DAL (DLL).

    My problem is that normally our company installs our own SQL Express Servers on the customer server. But in this case they are running a SQL Server 2005 with different attributes that normal in the connection string.

    Normally when I use the DBML i just add the connection string in the app.config of my DAL (DLL) and points the connection string of the DataContext to the right one in the app.config.

    However this SQL 2005 is placed on the customers network and cannot be reached from my local computer where I need to set up the DataContex to point to the right DB. Thus when i try to add this following connectionstring to the app.config it does not become accessible as a connectionstring in the properties of the DataContext.

    How do I solve this problem. I'm hoping i can skip making changes to the BLL itself.

     

    The first connectionString is the new one Im trying to get working.

    The secondary is what has been working for quite some time.

     

    In a nutshell. Cannot get the DataContext of the DBML to point to the new connectionString (I think it is because I cannot reach the SQL server from my development computer) any fixes?

    <add name="RemoteDBString"
         connectionString="Server=XXXX;Database=DB;UserID=XXXX;Password=XXX;Trusted_Connection=False"
        providerName="System.Data.SqlClient"/>
      <add name="NormalDBString"
        connectionString="Data Source=.\sqlexpress;Initial Catalog=AJA;Integrated Security=True"
        providerName="System.Data.SqlClient" />
    
    

    Wednesday, January 26, 2011 10:19 AM

Answers

  • Hi Thomas,

    Welcome to linq to sql forums.

    Base on your description I understand that you have the database and your development everionment(or  the code manage server )with the same compute.

    connectionString=”Data Source=.\sqlexpress;…


    The sql server2005 network configuration is default with enable so that I think it may be cause

    by the sqlserver’s network configuration.

    I suggest that you could have the problem at the SQl Server Forum “http://social.msdn.microsoft.com/Forums/en-US/oslo/threads”, I think there will be many expertes  with database.

    Additionaly, There is the description of database reomte config: http://msdn.microsoft.com/en-us/library/dd857537(v=vs.85).aspx

    And

    http://www.codeproject.com/KB/database/SQL_Server_2005_remote.aspx

    Have a good day!

     

    ·         ThconnectionString="Data Source=.\sq

     

    ·           <add name="NormalDBString"

    ·             connectionString="Data Source

    ·          

     


    If it's helpful for you, Please vote or mark. Thank you!

    David Peng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, January 28, 2011 3:11 AM
    Moderator