Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Can't connect to database file ( mdf )

Can't connect to database file ( mdf )

Scheduled Pinned Locked Moved Database
csharpdatabasewpflinqhelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I wrote simple winform ( part of it with WPF ). In the simple application i have some place that i get information from database ( from mdf file ). The code .. public SomeDBObject : System.Data.Linq.DataContext { ... some code ... } List< SomeDBObject > listViewItem = null; try { listViewItem = new List< SomeDBObject >(); using( DBDataContext dBDataContext = new DBDataContext( mdf_File_Path_String ) ) { listViewItem.AddRange( from item in dBDataContext.dBs select ( SomeDBObject ) item ); } } catch( Exception e ) { ... } now, on my machine and on some other machine all work fine. But some on some other machine that i install ( clean machine ) my application i get exception from the line using( DBDataContext dBDataContext = new DBDataContext( mdfFilePathString ) ) and the exception is about some problem with the sql on the machine. The exception: a database with the same name exists, or specified file cannot be opened, or it is located on unc share. This is happaning with win7 and win Xp also. I try to re-install the sql 2008 express - but this is not halping.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups