C# Database Programming for Beginners | Part 3 - Database Connection and Populating ListBox

SeeSharpCode · 133K views · 2014 · 10:25

Open on YouTube

Databases & storageSoftware practice, open source & careerstutorial

Why Stack Overflow recommends it

Stack Overflow users cite it as the tutorial they followed to wire a C# app to SQL Server, usually when their own connection string or connection code then fails.

Recommended by 1 people across 1 different months, 2016 to 2018.

What it is

A 10-minute beginner tutorial from the SeeSharpCode channel, part 3 of a C# database series. It adds controls to a Windows Forms app, connects to a SQL Server database with a SqlConnection, and fills a ListBox using a DataTable and SqlDataAdapter.

What people said

Recommends weis_ss · 2018-01 · Stack Overflow · on “C# + SQL connection issue”

I have a problem with connecting SQL base with c# code. I have done the database and tried to display if my columns are visible, there aren't any problems, warnings, messages in visual studio, but i can't see data from my base. It is very simple database. I used those tutorial to do this connection: [this video] But, i have made one database. Here is the SQL connection part of the program: public partial class MainWindow : Window { SqlConnection connection; string connectionString; public MainWindow() { InitializeComponent(); connectionString = ConfigurationManager.ConnectionStrings["projekt1.Properties.Settings.Database1ConnectionString"].ConnectionString; } private void MainWindow_Load(object s

Cites k.Sonnemans · 2016-12 · Stack Overflow · on “Unable to insert to SQL Server database”

[this video] i followed this YouTube guide but there's an error on the ExecuteNonQuery. It says: connection is not initialised

Cites user6478676 · 2017-11 · Stack Overflow · on “Get connectionString for current DB”

I'm trying to find out connectionString which would be like: TestDB.Properties.Settings.TestDBConnectionString ( according to this video [this video] ), but I'm working with WPF and there is no <connectionStrings> in App.config . I looked at properties of my DB and there was Connection String such as Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=//path_to_file//TestDB.mdf;Integrated Security=True - but it's not the same type was mentioned above. And it won't work for my connection below. I'm trying to connect like this: public partial class MainWindow : Window { string connectionString; public MainWindow() { InitializeComponent(); connectionString = ConfigurationManager.ConnectionStrings["d