MySQL VB.NET Tutorial 12 : Show database values in Table or DataGridView
VB.NET - How to get user entered data from datagridview to windows Visual Basic
Insert, Update and Delete from DataGridView to sql server,MySql Sql database Visual Basic
Microsoft Visual VB.NETI Windows Controls The Data Grid View
VB.NET Tutorial - Binding a DataGridView to a Database
VB.NET - How to save datagridview records on database table
how can i use data grid view to update data in database using C
Delete in Datagridview and SQL database Visual Basic
Save From datagridview to access database Visual Basic
Update database from DataGridView Visual Basic
transferring multiple row data from listview to datagridview c sharp
retrieving seleted value from combobox in datagridview
Updating database table from DataGridView Visual Basic
update DataSet from DataGridView, and update database from
How to Create a Simple Windows Forms C# Database Application
Searches related to c# datagridview database
VB.NET datagridview without database
VB.NET datagrid view
How to insert data from DatagridView to MS Access Database
Closed Caption:
hello guys welcome once again in this
video I'm going to show you how to load
your database table values in a . a
great view or our table
so let me show you what I'm going to
teach you today
so i have this . a great view control in
my form and when i press this load table
button it should the Lord all the table
values from the data which is present in
my daughter base this is the table and i
want to show all the table values
with the column names in the stable
so whatever table values are present in
this table in my school database
I want to show in this data grid view in
visual basic
so how can i do that or how can we do
this using visual studio i'm going to
show you so let's get started
what I'm going to do what you need to do
first is you need to take our . a great
view from here
so you will find this . a great view
control from here and just drag and drop
into your form
it looked like this ok so i have already
done that and just take a button from
your type tool box and I have changed
the name of this or text of this button
as Lord table and I have changed the
name of this button as a button
Lord table ok now what I need to do next
is i will select this button
I
and i will double click this button and
in here i have written a code to load
the table and the data grid view right
so let me explain what I have done these
two lines
you're already familiar with I think
because with every you in every video i
use them
these two lines are used to connect my
visual basic project to the mysql
database
just to clear my school corn is equal to
Nu my school connection and then just
copy this my skin connection .
connection string and give your
credentials of your my school server and
if you don't understand this
you need to watch the first few videos
of my play list of this
of mice will plus visual basic
so just write these two lines and these
this is the new thing to connect the
data grid view with the with your
database table so you need to declare
three variables all instances of these
classes cost declare them as da as a new
my school . r dr second declared them .
er db's data set as new . table and
third variable declare them be source as
new bindingsource ok so this will help
us to get the data from the database
this this one and these two variables
will help us to bind our data which we
get from the
my skin . a doctor to the data great
view
ok and then get this try catch block
this also have already shown you in the
last couple of videos so if you want you
can just copy this skeleton of the
Frankish block to catch any exception
when the credit occurs
ok now in the bracket triblock i have
just opened the connection with the
mysql database
just copy this my school connection but
open this will open the connection with
the database right
and in here I have the key and a string
variable called creddie this creddie
will contain the ready
which you want to perform
in the database right so just like this
select star from your database name .
your table named my daughter base name
is database and my table name is the
data that's what
here i have written select star from
database . e data and then just copy
this command variable which I have
declared above i have already shown you
in the last video that you need to
declare these global variables first is
them my school gone as my skill
connection and them command as my skills
command right so just declared these in
the global variable
I think you have already have them if
you are following these videos and then
write that command variable is equal to
Nu my school command and just passed
York ready
which is this query
and just past the my school connection
which is this one that just passed
through argument in the smile mysql
command function one is this ready and
second is my squirrel connection right
then take this
sdo which is my school . a doctor
variable . select command just right as
the dot select command is equal to
command
so this will perform your credits right
and then in the second line
what we are doing is we are writings as
da . will and in the bracket we are
passing this data set variable this line
will do is it will first line is
performed just the spread II and just
taking all the values and then this this
line will fill all the all the values
which are coming from this ready to this
data set right and then just try to be
source which is your this
bindingsource radio blue dot data source
is equal to EB data set
so now we are filling our data set to
add the binding source so that this
binding souls can bind the data set and
your data grid view right
just write be sauce . data source is
equal to BB data set and in the next
line just write the name of your data
grid view which is the name of this got
a great view which is that agreed we
want
. data source is equal to B source and
then the last line is sta . update and
in the bracket just passed this DB data
set
yeah so this is the cord you need to
write in order to
kill your daughter great view with the
my school table values if you want just
pause the video and just copy all this
code right now we are going to run this
program
and the username and password and now
when you just click this load table
button this lord's all the columns from
your eid our table which is this table
and it loads all the values in this data
grid view
now suppose you don't want all the all
the values you just want some of the
columns for example you want the problem
let's say eid name surname and needs
these four columns you need only and you
don't want to show all this user name
and password and other columns and the
data grid view this is very simple do
you just need to change the quality just
right
instead of select star you just try this
select the ID which is the name of my
first column but name , so name , age
so what are these four things these four
things or before values are the column
names of my first four column the ID
name surname in each right so just write
the name of the column separated by ,
which you want to show in the data grid
view
now once again when i run the program
and when i click this low table working
now it only shows only for bones right
now the next thing is to Lord the table
for example if what you want is as soon
as you log in to the second form of as
soon as you load the second form
you want to load all the table without
pressing this button
ok so what you can do is you can define
a new sub so i'm defining a new some
just above my end class bored i can
define the new sub or i can define a new
sub bit above this button Lord to league
but Lord table given any way you can
define a new sub
just try and strive with Lord table and
I forgot some so I right here
sub and just press enter here so this
will create a new sub for you
and in this sub or subroutine just copy
all the court from your this button
click event Lord table button click
event and just copy all the cord from
here
from start to end and paste it in this
load table summer right
and next what we are doing going to do
is just copy this load table of sub from
here and just click your form anywhere
not any control but the form as a whole
just double click it and at the top
just paste this function load table
function and oh ok I don't need this
semi cool
just paste this sub here
ok and when now when I run this program
and when i login and as soon as my
second form opens that values are loaded
automatically and I don't need this low
table but many more
ok so this also you can do it right now
the third thing is suppose you add a new
data through the database so let's see
when we add a new data right now we have
14 entries in our database right
I want to end up employed in 15 some
name some sort name and age and I save
it into the daughter of this
I save the data that are be that is
saved
but you see here this table is not
updated when I entered the 15 15
employee ID and this will or this
employee entry will come here when you
click this no table button
so what this low table is doing is just
refreshing your
are you ready are you refreshing your
gift loadable court will send a new
quality which will give you all the
values from the database so this load
table is also working as a refreshing
refresh button forum for your quarters
so when you click this
now you can see the 15 to entry in the
data grid view
ok and in here in the database also you
will be able to see when you refresh the
database you can see the 15 entry
so this also is a handy function this
low table whenever you save the data and
automatically you want to refresh your .
a great view
what you need to do is just copy this
low table function or sub once again and
go to this saver button click event and
this court i have written in the last
videos when I have shown you how to save
your daughter using your visual basic
windows form application in your mysql
database so just go at the bottom of
this code and paste this load table sub
what this low table soft will do is
after you save your daughter in the
database
it will perform this lord's table sub
and what this low table sub will do is
it will refresh the credit at all has
been sent the new credit to the database
and it would reflect your data grid view
as soon as you save the data in the
database
this function you can also paste in
update button click event at the last
and in the delete button click event at
the last of the order subroutine
so now every time you perform any action
you're not a great view is refreshed
automatically so for example I want to
delete this employee ID 15
what i will do here simply i will write
employee ID 15 i will delete it and as
soon as I delete the the i press delete
all button this will be the fresh
automatically and you will be able to
see only 14 employee ID so let's see i
delete it and your . the current view is
refreshed automatically and you can see
here you have only 14 employee ID and
once again if you want to
I don't want more employee some name and
some so name and age and save it and as
soon as you save your daughter it's
there in the data grid view
so in this way you can load your
daughter great view using the original
basic windows form application from the
table in the my school table
I hope you have enjoyed this video
please rate comment and subscribe and
bye for now
Video Length: 16:02
Uploaded By: ProgrammingKnowledge
View Count: 102,982