Click here to Skip to main content
Rate this:
 
Please Sign up or sign in to vote.
See more: .NET3.5 C# .NET SQL-Server , +
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 9: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
Top Experts
Last 24hrsThis month


Web01 | 2.8.160204.4 | Advertise | Privacy
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service

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