Hello friends, I hope you all are fine and having fun. In today's tutorial, we will have a look at updating database table with Programming in VB 2010. In the previous posts of this tutorial, we have seen How to Create a database in VB 2010 and then we have added button control in VB Database in it, which was quite an easy job. But usually in such applications, its necessary that the application update its database automatically. Like in one of my project, I have designed a software for hotel management in which the data is coming from all the rooms wirelessly to the master room where the software is installed. It was quite a big project but the thing, for which I have mentioned this project, is the software installed in the master room was updating its database itself i.e. if data of room 1 changed then software automatically update the info of that room in its database.
So, for students and also for freelancers its essential that they must have full command over database, and in order to understand today's post its also essential that you must read the previous two posts of this tutorial.Dim Var1 As database1DataSet.ContactFormRow 'Defining a vaiable Dim Var2 As database1DataSet.ContactFormRow 'Defining a variable Var1 = database1DataSet.ContactForm.FindByID(2) 'Here, we are assigning our variable Var1 the location of row 2. Var2 = database1DataSet.ContactForm.FindByID(2) 'Here, we are assigning our variable Var2 the location of row 2. Var1.FullName = Var2.LastName 'Now as our variables are in row 2 so they can access any value in row 2. So in this line of code, I just assign the LastName to First Name. So, after execution of this command whatever present in Full Name of row 2 will be replaced by Last Name of row 2. Me.table5TableAdapter.Update(Me.database1DataSet.ContactForm) 'Now at the the end updated our database or in other words save the database.Mostly data we receive is through serial port so in that case simple remove the Var2 with the variable in which you are receiving data from serial port. For the programming of serial port in visual basic 2010, check the below tutorial. That's all for today friends and finally this tutorial completed. If you guys have any question regarding any part kindly ask in comments and also subscribe to our newsletter to get the new updates and software.