none
LINQ to SQL Connection to a database on a corporate server RRS feed

  • Question

  • So here is what I am trying to do. 

     

    I am creating a form that inserts and retrieves data from a database on a server running SQL Server.  I currently have no problem running the program and connecting to the database from my machine with the VS 2010 development environment.  But when I run the executable on a different machine with 4.0 .NET Framework and without VS 2010 it crashes.  I think the error message is telling me that the program cant find the database.  I created the dbml file by dragging and dropping the tables from the Server Explorer and I also saved the username and password into the app.config file.  In all the tutorials I look at its as easy as that.  But for some reason I can't get my program to connect when I run the executable on a different machine.  

     

    I don't understand what I am doing wrong and why the program is unable to establish the connection with the database. 

    Friday, August 27, 2010 5:13 PM

Answers

  • Hey everyone,

    Sorry for the wild goose chase.  It turns out this has nothing to do with the LINQ 2 SQL.  Its due to a my program trying to access files that exist in my Debug directory that are used by picture boxes on the form.   Thanks for all the help anyways. If it isn't obvious I am a huge NOOB :).

    • Marked as answer by iWas404'ed Monday, August 30, 2010 6:29 PM
    Monday, August 30, 2010 6:29 PM

All replies

  • Hi FoxZero,

    Could you please post the whole error message and the connection string ? Thanks.

    Best regards,

    Alex Liang

    MSDN Subscriber Support in Forum

    If you have any feedback on our support, please contact msdnmg@microsoft.com


    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.
    Monday, August 30, 2010 2:51 AM
    Moderator
  • Connection String:
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <configSections>
        </configSections>
        <connectionStrings>
          <add name="BDTPrototype.Properties.Settings.BDTtestConnectionString1"
                connectionString="Data Source=CORP\SQL;Initial Catalog=BDTtest;User ID=rmalone;Password=ryan"
                providerName="System.Data.SqlClient" />
        </connectionStrings>
    </configuration>


    Error Message:

    Problem signature:

      Problem Event Name:                        CLR20r3

      Problem Signature 01:                       bdtprototype.exe

      Problem Signature 02:                       1.0.0.0

      Problem Signature 03:                       4c74044a

      Problem Signature 04:                       BDTPrototype

      Problem Signature 05:                       1.0.0.0

      Problem Signature 06:                       4c74044a

      Problem Signature 07:                       10

      Problem Signature 08:                       61

      Problem Signature 09:                       System.IO.FileNotFoundException

      OS Version:                                          6.1.7600.2.0.0.256.48

      Locale ID:                                             1033

      Additional Information 1:                  0a9e

      Additional Information 2:                  0a9e372d3b4ad19135b953a78882e789

      Additional Information 3:                  0a9e

      Additional Information 4:                  0a9e372d3b4ad19135b953a78882e789

    Monday, August 30, 2010 2:25 PM
  • Can you debug, and get the Exception Message (Exception.Message)?

    Side note: You got to love FileNotFoundExceptions, not being wrapped.  Here is a quote from Microsoft's API handbook, chapter named Exceptions.

    "[T]he existing exception type must make sense for your error condition.  For example, you don't want to throw FileNotFoundException from an API unrelated to accessing files." (Framework Design Guideline, 2ed. Page 224)

    Monday, August 30, 2010 4:13 PM
  • Hey everyone,

    Sorry for the wild goose chase.  It turns out this has nothing to do with the LINQ 2 SQL.  Its due to a my program trying to access files that exist in my Debug directory that are used by picture boxes on the form.   Thanks for all the help anyways. If it isn't obvious I am a huge NOOB :).

    • Marked as answer by iWas404'ed Monday, August 30, 2010 6:29 PM
    Monday, August 30, 2010 6:29 PM
  • HAHA.

    It did seem pretty strange for LINQ to throw a FileNotFoundException. 

    Be careful with abosolute and relative paths ;)

    Monday, August 30, 2010 6:40 PM