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

preview_player
Показать описание
Now that we know how to run SQL queries against the database, we begin to implement this functionality using C# code and a Windows Forms database.

We add some controls to the form, connect to our database using a SqlConnection object, and populate a ListBox using a DataTable and SqlDataAdapter.
Рекомендации по теме
Комментарии
Автор

I just learned the theory of relational databases and was hopping to make a Window's App that used a database to store data, but I was getting confused of how these DataTables and Adaptors worked. This is just perfect! It's exactly what i was looking for, thanks man! I was getting sick of all the indian tuturials that don't explain shit.

chc
Автор

Thanks to author a lot. For anybody who is going to make it with WPF instead of WindowsForms, here is the difference:
listRecipes.DisplayMemberPath = "Name"; // Instead of DisplayMember
listRecipes.SelectedValuePath = "Id"; // Instead of ValueMember
listRecipes.ItemsSource = recipeTable.DefaultView; // just adress to DefaultView property not just to the Table
I faced that When I was doing the exercise on WPF, maybe it will save the time for somebody

vitalydushko
Автор

Some advice for other coders following this tutorial in 2021, if you use the newest Visual Studio Code then System.Data.SqlClient might not show up in the References. It can be installed into the solution using Tools - Nuget Package Manager.

ewoutlagendijk
Автор

You rock! this is exactly what I needed

Hcloud
Автор

Thanks a Lot dude it was very helpful, (sorry for the bad english)
i just wanna add that for those who uses Access database you should use the oledbconnection and the oledbDataAdapter instead of the Sqlconnection and the sqlDataadataadapter, Thanks a lot bro Again :D

moadaitsaid
Автор

Try making your fonts bigger for your videos on this stuff? Thanks!

dickietaylor
Автор

I'm using Visual Studio 2017 Enterprise and I get an error when I try to use Although I do import the system.configuration

AricRecker
Автор

HELP!: The ConfigurationManager on the line 24 of your code, appears as error on mine. I have already added the: using System.Configuration; If that is the thing that it's needed.
Please help...let me know what may I have been missing.

yveverly
Автор

These video are great. Could you make the text a bit bigger?

christianrodier
Автор

0:30 - 1:45 A way to utilize designed database very quickly, showing how to edit/view db info through form
1:46 - End How to use SQL DB inside application

adocsgo
Автор

I followed you up until this video. There's so many things in here that do not come default with Visual Studio and Its impossible to follow without another source.. For example, my "Add New Data Source" button was grayed out, and a drastically different Reference Manager. Mine doesnt even show the framework tab. Perhaps I'm just not advanced enough for this project.

NathanSStorey
Автор

0:31 the icon Add New Data Source is disabled, I think I need to connect to the database somehow

nicolasv
Автор

I cannot get thru this. I received two error msg: 1) 'FrmMain' does not contain a definition for 2)'FrmMain' does not contain a definition for

yqwu
Автор

I wast trying to implement the exact same idea to the WPF because I found them nice but I got into problem, I cannot assign the listBox datasource to namesTable( or receipeTable ) in this videos case and help would be appreciated

naveenspanwar
Автор

@SeeSharpCode Hello, Around 1:50 when I remove the automatically-added controls (binding source, table adapter, etc...) to clean up the form, I get error messages, complaining that those components are missing. I did exactly what you did (i.e. dragging the tables onto the form) so ho come you can delete those bits without any problems?

JoshyHJoshy
Автор

Can you select 2 ValueMembers? You selected the "Id" but what if i want for example "ID" and "Age"?
is this possible or not?

MrHalfLifezzz
Автор

I did as shown, but whenever i try to run this form file, Program.cs runs since it has the main method. what can be done to make sure my form file should run? Thank you

AmbiguousAbhi
Автор

Keep up with this kind of explanation, its great, I have one question, how I can turn on this helper codes in VS 2015, for example in 7:15 min. you see what VS recommends to write in the code, I dont have that, how I can turn on?

miticjovan
Автор

I don't get the value back at 10:10.. what could I be doing wrong?

antoniown
Автор

I'm quite sure I copied everything perfectly, but when I run my code the listbox won't show anything..

mcludo