none
UnHandled SqlException RRS feed

  • Question


  • I am using VS 2008 and LINQ To SQL. I've created a DataContext object (called db), attached data to him, then tried to submit teh changes.
    When debugging the "db.SubmitChanges()" , it throwss an exception which says:
    "An attempt to attach an auto-named database for file "<here comes the path of the mdf file>" failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share".

    The connection is opened, and i have no sharing at all.
    Could anyone please help me,
    It's quite urgent

    Thanks in advance,
    Sunday, May 17, 2009 10:17 PM

All replies

  • Can you read from the database fine?

    Otherwise verify that the DataContext is current with the database which is being accessed. If you have to delete all the tables and re-add them to the dbml context file then do that and try again.

    William Wegerson (www.OmegaCoder.Com)
    Monday, May 18, 2009 5:52 PM
    Moderator
  • Actually, I have not tried to read from the db but I assume that it won't let me do so.
    Meanwhile, I have only one idea why it occurs: I have no separated SQL Server software installed, I use the SQL Server compact edition that comes along with VS 2008.
     
    May it be the problem??? 
    Monday, May 18, 2009 10:13 PM