Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Error in mdf SQL Connection string C#

$
0
0

Dear All,

i have created mdf file in C# windows application form  project , May i know  why i m not able save the data into mdf DB permanently ?  Each time i run the program, it's work fine and able save the data in mdf. after i shut down the pc and run on next day, the data will empty.  

kindly advise, thank you

app.config code

<add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\OUM.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/></connectionStrings>

Code behind SQL connection code

  string MyConString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
                using (SqlConnection connection = new SqlConnection(MyConString))

Server Explorer  in VS Studio show Connected.

 


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>