Setup creation with database of windows form application

Mar 12 2017 11:25 AM
Hello ,
 
      again one problem .... I'm not gatting solution plz help...
 
    I created one windows form there was two textbox and one buttion for insert..
   i written my connection like...
 
 SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=c:\users\anilananda\documents\visual studio 2013\Projects\demoProject\Database1.mdf;Integrated Security=True");
 
it is working but when i put like this
 SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;");
 
that time it is not inserting and no error message also ....why ?? plz help
 
 
=====================
 
actually i want to create a setup file so i d'nt want to give connection like 1st one because if i give like this it will work in my system only.
 
so i want to give second one type so that it should work in others system also .
i want to provide the complet databse (Database1.mdf ) 
in my project file so that it will work as a local databse no need to install sqlserver in other system. because database is available.
 
 
but this how to do this i d'nt know ... plz any one help me.
 
My intention is only create setup file with databse that i will provide in project folder and after creation exe file it should work in other system aslo without having sqlserver in there system.
 
 
 
 
 
 

Answers (11)