0

I created a working Data-Based Database. I can also use this db with the DataGridView.

But how can I create a connection to the database with C#? I searched already before but nothing worked for me.

In my App.config is also

<connectionStrings>
    <add name="make_it_server_verwaltung.Properties.Settings.ServerlistConnectionString"
         connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Serverlist.mdf;Integrated Security=True"
         providerName="System.Data.SqlClient" />
</connectionStrings>

So how can I create a connection to my db and how can I add/delete/change/read my database over C#?

Thank you ^^

Working DataGridView

2
  • We'd like to help, but I fear your question is too broad. I'd suggest you try to find some tutorials to follow. And do feel free to come back with more specific questions. A related "this is absolutely not how you write production code" answer can be found here: stackoverflow.com/questions/29712783/… Commented Mar 12, 2019 at 20:59
  • You can access your config file with ConfigurationManager.ConnectionStrings["name"]; , I believe Commented Mar 12, 2019 at 21:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.