How to connect to a SQL Server Database in C# (using ADO.NET data providers)

preview_player
Показать описание
Learn how to connect to a SQL Server database using the ADO.NET data providers for C#.

Useful Links:
Code sample with Database script:

The Connection Strings Reference:

To download Visual Studio 2019:

Topics:
00:00 Intro
00:12 Getting started
00:22 Sample database: tables and data
01:02 Creating the sample application that will connect to the database
01:28 How to import the System.Data.SQLClient namespace?
02:10 The necessary classes: SQLConnection, SQLCommand, SQLDataReader.
02:48 What is a connection string?
03:35 How to add a connection string to your code?
04:02 Step 1: Create and configure a SQLConnection object.
05:41 Step 2: Create and configure a SQLCommand object.
07:08 Step 3: Retrieve data using a SQLDataReader object.
08:35 How to output retrieved data?
10:15 How to keep the console application open?
10:29 Run and test your application.
10:51 Thank you and Subscribe!
Рекомендации по теме
Комментарии
Автор

yo thnx bro, you saved me. took me forever to find a video using the datareader

itsjustshxrif
Автор

Great and clean explanation, you are the man. you do it all.

dzeblemartin
Автор

Thank you for this perfect tutorial! I finally retrieved my data.

iroquoispliskin
Автор

You gained a new subscriber, thank you for sharing the knowledge this helps me a lot thorough schooling!

mikesara
Автор

Clear and super understandable! could you make it with stored procedures CRUD ?

attilaguba
Автор

please upload next tutorial for converting this program to another format like TXT XML etc

B_Drive_K
Автор

Hey, great tutorial, loved it!!
But I didn't understand what to paste in front of "Server=" in the connectionString string.
Could you please help me with it?

aniketkale
Автор

You dragged the video out. You did correctly show how to connect to and extract data from SQL Server, however you could have done it in a shorter video.

pavelschannel-alittleoutof
Автор

thank you for tutorial and ur mother for u!

ravliiik
Автор

Did you seriously declare the string variables inside your while loop? what if that database has 10^9 entries?
R.I.P. memory...

naashchaa
Автор

SqlConnection class did not found in the current namespace? can you help me in this error

yashwantsingh