MySQL Insert and Update Database Records with VB.NET Using ADO.NET - Visual Basic Tutorial

preview_player
Показать описание
In this Visual Basic 2010 programming tutorial, we will connect to a MySQL database and INSERT new records into a table, and then we'll UPDATE those records.

In this video, we will perform the following tasks:
1.) Creating the Connection Objects, a Connection String, and a Query String
2.) Connecting to our MySQL Database
3.) Write / Insert new database records
4.) Update database records
5.) Use a LEFT table join to show all records in one table and only matching records from another.

This tutorial assumes that you already have an operable MySQL database, access to the database, and a basic working knowledge of your database.

:-)
Рекомендации по теме
Комментарии
Автор

Thanks for taking the time to teach newbs like me. 

kendiener
Автор

your the best VS teacher in youtube man. Your so cool you could lots of stuff in VS! I wish I was like you, I am only good in web development XD I'm trying to learn VB with mysql and this video is the best video I found! GREATE! 4 THUMBS UP!

aprilpineda
Автор

Hey there, lufertyboom! Data grids are a totally different beast than the display method I'm using here with. There are different ways that you can approach this, too. I know that you can update records in a table via a datagrid, but I haven't tried this yet, so I'm uncertain of exactly how that will work.It should be simple enough to use cell values from records in a datagrid as query values. For a Clock in-out situation you can query the username, day, and In/Out status and insert accordingly.

AardaerimusDAritonyss
Автор

Hello there! I'm having some difficulty understanding, but it sounds like you want to create a database for electronics. This sounds like a great use for a database, though when it comes to storing images it's best to keep those on disk and only store "pointers" to the database rather than binary "blobs" of data, which can cause your database to grow very rapidly.

AardaerimusDAritonyss
Автор

You can store pretty much anything to your database. The important thing is to know how you want the data to be stored, retrieved, and what relation it has to other data. Presumably, you just want to store treeview node text to some table, but I'm not entirely certain how you want it stored. Do you want each node to be stored as a new record, or do you want all nodes of a branch to be stored to a single record?

AardaerimusDAritonyss
Автор

You could create a config file, or you could write the values to the system registry. Ultimately, if it's a very sensitive environment you'll want some form of encryption on the config file, otherwise you could simply use native .NET gzip compression, which would sort of mangle the the values.

Otherwise, If you're completely comfortable with your directory security alone and certain your config file would be secure, then you could just write a plain-text config file with a streamwriter.


AardaerimusDAritonyss
Автор

You should be able to use something like this in your UPDATE statement:
SET onhandqty = (onhandqty - orderqty)

Just use your field names. :-)

AardaerimusDAritonyss
Автор

SO.... MANY... THUMBS!!! :-O lol! Thanks a ton for the positive feedback! :-)

AardaerimusDAritonyss
Автор

Hello, I am having a project about ordering system but I get stuck on how to deduct the number of quantity in the database of my project thank you for your reply

asadog
Автор

I'm certain that it can be done, though I don't know how to do this in c++ as I'm not very familiar with that language.

AardaerimusDAritonyss
Автор

lets say i want data from the textbox straight to the mysql database ...how can i do so? i dont understand how it is done. Please guide me

gilmandanilo
Автор

can we used mysql with c++? for example dev c++, I saw a driver for c++ in mysql website..

aprilpineda
Автор

Hello, Felix!

At the moment, I'm not sure where my source went, however I have another (better) MySQL project that includes all of the same MySQL routines (view, insert, update, delete, etc.), if you're interested. :-)

Just shoot me a PM and I'll get you the dropbox link.

AardaerimusDAritonyss
Автор

I love your videos AND I think hard coding sql in your code is the best way to learn. Do you use sql params? SqlCommand.CommandText = "SELECT * FROM tblTable WHERE TableID = @Parameter"
Nice for making rollies- if u follow :)

jsmythib
Автор

could you help me..you see im trying to create a database program using mysql and visual studio2010..im having trouble with my timer..i was trying to make a program using for employees where they can "time in" and "time out"..but i dont know how to put the time IN my mysql...as I press the button "time in" in my VS i cant get it to register in my mysql table.. could you help me how to code it..and how to register the time as the employee "time out"..thanks :))

lufertyboom
Автор

hey, i need your help plzz ...while im trying to update my database using my application, an error msg appears

"" Update requiert un UpdateCommand valide lors du passage de la collection DataRow avec des lignes modifiées. ""
what should i do ??!

hamzatouati
Автор

what language is the above code written in??? Thanks in advance!!!

armanpatnaik
Автор

hi sir i would like to save and array into my database sql server is it posible?
Audio Setup Package 1
--2 Speakers Fitlord
--2 Tweeters
--Boss Amplifier
--Wires
--2 Colored Lights
--2 Blinking Lights

how can i save this into my database?..it is in the treeview control
Please any Ideas?.
Thank you...

devilcriedonme
Автор

You just treat the textbox like any other variable and break up the VALUES part of the INSERT string like this:

VALUES('" & TextBox1.Text & "', '" & TextBox2.Text & "')"


AardaerimusDAritonyss
Автор

The answer is "yes" and "no". heheh
Yes - your MySQL database could manage thousands of players. :-)
No, it couldn't - and shouldn't - keep up with game play. You probably wouldn't want to use MySQL or any other database inside of your game environment. Once the player has successfully authenticated, access to the database should no longer be required. Character data could be periodically be written to the database - like a scheduled save routine, but you shouldn't do that in real time.

AardaerimusDAritonyss