VB.NET Tutorial – Connect & Query a Microsoft SQL Server Database – Part 1




About this tutorial:

Video duration: 01:35:30
In this VB.NET Database Tutorial, I will show you how to connect and query a Microsoft SQL Server database from your Visual Basic .NET application. We will build an improved connection control class for simplified access to our database.

Additionally, we will create a database search feature with wildcard support and populate a DataGridView and ComboBox with a database query.

SHORTCUTS:
0:25 Preparing the database
15:34 Creating your application
26:35 Building your SQL Control Class
1:06:00 Using the SQL Control Class
1:09:10 Query SQL to a DataGridView
1:16:33 Building a parameterized…

Post Author: OfficeTutes.com

Apple lover, ICT and LEAN consultant, MS Office lecturer My other website with video tutorials - Tutorials, guides and news for iPhones and iPads

34 thoughts on “VB.NET Tutorial – Connect & Query a Microsoft SQL Server Database – Part 1

    misperry

    (August 13, 2020 - 5:49 am)

    So how do you use the conneciton override you talked about? I would like to open another form and get user name and password info from user and then when they click the Search button it uses that for the connection. However, I run into lots of problems with not initializing the conenciton string on startup.

    Samir Parikh

    (August 13, 2020 - 5:49 am)

    Thanks a ton. Your teaching is very good appreciate the way you understand and is really effective. Great Job. God bless you, I had seen many lectures, but your teaching I like the most.

    Vikas Shah

    (August 13, 2020 - 5:49 am)

    Hi, I am making a Web Application and have followed your excellent video to connect to SQL. Everything works fine but the gridview is not displaying any records. Can you help

    Tom McMeekin

    (August 13, 2020 - 5:49 am)

    Hi VB, Do you know how the Class SQLControl could be used to run a stored procedure in a ms server?

    prinschoco

    (August 13, 2020 - 5:49 am)

    Thanks I could simplify my code at work a lot using this SQL control class.

    Jordan Lesesne

    (August 13, 2020 - 5:49 am)

    Great tutorial! Thank you!

    srirag kt

    (August 13, 2020 - 5:49 am)

    Awesome 👍

    James O'Connor

    (August 13, 2020 - 5:49 am)

    Great video. I tried adapting your solution to an asp.net web enabled solution but the GridView displays as empty on my first web page when it's displayed. Have you made a similar video illustrating how to do this as a web solution using asp.net rather than forms?

    cpachch

    (August 13, 2020 - 5:49 am)

    getting error BC30201: Expression expected. on following line.
    ' LOAD PARAMS INTO DB COMMAND
    'Params.ForEach(Sub(p) DBCmd.Parameters.Add(p))

    Ronald Waanders

    (August 13, 2020 - 5:49 am)

    Hi, I realy love your tutorials… I learnd many new, now I have a problem.
    I'm sure you can help me… I want to print my data, using the DBControl, can you help me with it ??

    yan poletto angulski

    (August 13, 2020 - 5:49 am)

    Ok man, its looks good its loooks ok but you forgot the main reason im here, how do i update the dataset and datatable with this query, counting we have 2 sql queries?

    20chrome11

    (August 13, 2020 - 5:49 am)

    uhm hey, first of all, i used this tutorials code as a reference to my program, it is a program that puts a name and time into the database . i want to add an algorithm where, by the time i delete the user( or something relates to this), i need to get the time inputed in that name/ row and compute its timespan so that i can put value into it.

    so heres my idea, i wanna put THAT inputted time from the database and subtract it to the current time ( by the time it deletes the the user/name )

    and my question is, how would you do it ?

    thanks man, i really would appreciate it

    Power Overwhelming

    (August 13, 2020 - 5:49 am)

    Your tutorials are too good to exist. 10000/10

    Bob Briggs

    (August 13, 2020 - 5:49 am)

    fixed it after deleting report instances of sqlexpress then used trusted connection

    Bob Briggs

    (August 13, 2020 - 5:49 am)

    No matter what I do I cannot log into the db with connection string

    Azhar Khan

    (August 13, 2020 - 5:49 am)

    please help me i create same project but error will be showed "login fail for user sa

    NORTECLA PORTUGAL

    (August 13, 2020 - 5:49 am)

    Great work. Thanks for this great job.

    Giorgos Nasenas

    (August 13, 2020 - 5:49 am)

    Thanks for the tutorials. Great Examples for real work and great for teaching

    psychoLeow

    (August 13, 2020 - 5:49 am)

    You are absolutely amazing. 🙂

    Fernando B

    (August 13, 2020 - 5:49 am)

    Can I use the same steps using a service based database. i would like my project to be portable once finished. Thanks in advance

    Moses Lau

    (August 13, 2020 - 5:49 am)

    Thanks for the tutorial! I really like the clean codes using classes, still learning for this skill 🙂

    Ikhram Lubis

    (August 13, 2020 - 5:49 am)

    Never give up

    8T8Keyz

    (August 13, 2020 - 5:49 am)

    22:24 – THIS IS the BEST THING I'VE HEARD!!! EXACTLY what I'm trying to do… THANK YOU!!!

    Vincent Mo

    (August 13, 2020 - 5:49 am)

    This is so lame. why can microsoft just do like one click and all these will be generated? What is their purpose behind this for making it so complicated?

    Chaz Bush

    (August 13, 2020 - 5:49 am)

    Amazing Tutorial Man!

    FERRISHVAC

    (August 13, 2020 - 5:49 am)

    Great Resource, Thank You Sir you're the best

    Arjun Khatiwada

    (August 13, 2020 - 5:49 am)

    Really great!, we expect such more other videos, Thanks a lot.

    Lorenzo Lopez

    (August 13, 2020 - 5:49 am)

    Great Video/ Learned a bunch

    MS COCO

    (August 13, 2020 - 5:49 am)

    you are the best thank u

    ali ali

    (August 13, 2020 - 5:49 am)

    why not use ExecuteNonQuery() in sub ExecQuery() when you use insert or delete in query

    GR33N TauRu

    (August 13, 2020 - 5:49 am)

    what is the alternate of microsoft SQL server management studio, if i dont have that?

    Sunil Kumar

    (August 13, 2020 - 5:49 am)

    Is there any way to connect with teradata ?

    buddyroach

    (August 13, 2020 - 5:49 am)

    God this is painful to watch. Gtf on with it

    Jason Todt Videos

    (August 13, 2020 - 5:49 am)

    I enjoyed your video! great work. Would you mind showing how to allow the end user to map and connect to a SQL database please? Example would be to place the SQL database onto a shared drive and multiple end users would be able to locate and connect through a mapped drive. Thank you for all your videos!!

Leave a Reply

Your email address will not be published. Required fields are marked *