Click here to Skip to main content
13,194,662 members (52,074 online)
Rate this:
 
Please Sign up or sign in to vote.
Hello,

AttachDbFileName=|DataDirectory|\abc.mdf;Database=abc, It's not running after the created .net windows application setup or exe,It's not running in to another system. I need Database name must,but it's not attaching, Database problem creating.

<connectionstrings>
<add name="GodrejInteriour.Properties.Settings.GodrejInterioConnectionString">
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\abc.mdf;Database=abc;Integrated Security=True"
providerName="System.Data.SqlClient" />


<appsettings file="..\app.config">
<add key="ConnString" value="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\GodrejInterio.mdf;Database=abc;Integrated Security=True;User Instance=True" />
<add key="ConnString1" value="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\GodrejInterio.mdf;Database=abc;Integrated Security=True" />
<add key="ClientSettingsProvider.ServiceUri" value="" />


Please help me.

Thanks.
Ankit
Posted 27-Dec-12 8:28am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

|DataDirectory| is the pat in web structure, like ASP.NET
so it appears like ..\App_Data\abc.mdf
Instead of it you must during installation process change it to real DB path!
Also i'm not sure about .\SQLEXPRESS , do you really sure about it existance on remote machine ??
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Add prerequisite "SQL SERVER EXPRESS" in setup
Add abc.mdf file in setup
make sure abc.mdf is in same folder where your EXE file is placed after installation.

Happy Coding!
:)
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

I need the error information.
AttachDbFileName=|DataDirectory|\abc.mdf;

1.You cant try change the reative address to absolute address.
e.g.
AttachDbFilename=E:\\directory\\abc.mdf
2.Check, whether the connection is available
3.You should login it by sql server type rather than windows type.
4.You can load the mdf into mssql,then use it.

Just try it!
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.171018.2 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100