Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My application is not running, when i try to run on another pc after installation it shows a message- "object is not set to instance of an object".
Posted
Comments
Kschuler 24-Sep-14 13:57pm    
Can you post the code that is blowing up?

1 solution

Your mdf file should run on a shared machine, not be deployed as it is central in the database system that you are updating in the same database or your updates wouldn't be visible to each other. So move the database to a network location. then make that locations reachable from the places you deploy and update your database connection.
1. Detach, filecopy, attach: MSDN steps to complete[^]
2. configure to allow external connections
http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx[Allowing remote connections]
3. update sql connection string
Add a connection to Server Explorer pane in MS Visual Studio, then rightclick on it and select properties (f4) you should find the connection string. Copy that to where you had one.
 
Share this answer
 
Comments
Mufid Abdul Gafoor Bagdadi 24-Sep-14 3:59am    
application is running on my pc, but when i change the machine the error popups.
Thomas Nielsen - getCore 24-Sep-14 4:39am    
presume because your database is also local ?!
Mufid Abdul Gafoor Bagdadi 24-Sep-14 7:02am    
i don't get you.
Mufid Abdul Gafoor Bagdadi 24-Sep-14 7:07am    
Why i can't deploy .mdf file in my application?
Thomas Nielsen - getCore 24-Sep-14 7:44am    
Well it's not that you cannont but the MDF file is a datbase file. Normally the reason to use a database file is that you want several people to access the same data or parts of it, make individual rows in the same table e.g.
So if you install two different mdf files on two different users, you have two databases, not one, which is not likely to be what you want or perhaps i misunderstood the problem you face?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900