Click here to Skip to main content
Rate this: bad
good
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.



connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\abc.mdf;Database=abc;Integrated Security=True"
providerName="System.Data.SqlClient" />

 





 
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!
Smile | :)
  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
0 OriginalGriff 420
1 CHill60 410
2 Sergey Alexandrovich Kryukov 354
3 PIEBALDconsult 205
4 BillWoodruff 190


Advertise | Privacy | Mobile
Web01 | 2.8.141015.1 | Last Updated 28 Dec 2012
Copyright © CodeProject, 1999-2014
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