Popular Posts

VB.Net Update MySQL Data

Share it:

How To Edit Data In MySQL Database Using VbNet

VB.Net Update MySQL Database Data

In This VB.Net Tutorial  We Will See How To Get Data From TextBoxes And DateTimePicker  And Update The Selected Data From MySQL DataBase Table Using ID To Just Edit The Data With This Specific ID Using MySqlCommand With Parameters In Visual Basic.Net  Programming Language And Visual Studio Editor.


Project Source Code:

Imports MySql.Data.MySqlClient

Public Class Update_MySQL_Data

    Dim connection As New MySqlConnection("datasource=localhost;port=3306;username=root;password=;database=s_t_d")

    Private Sub ButtonInsert_Click(sender As Object, e As EventArgs) Handles ButtonInsert.Click

        Dim command As New MySqlCommand("UPDATE `student` SET `FullName`=@fn,`Address`=@adds,`BirthDate`=@brd WHERE `Id` =@id", connection)

        command.Parameters.Add("@id", MySqlDbType.Int64).Value = TextBox1.Text
        command.Parameters.Add("@fn", MySqlDbType.VarChar).Value = TextBox2.Text
        command.Parameters.Add("@adds", MySqlDbType.VarChar).Value = TextBox3.Text
        command.Parameters.Add("@brd", MySqlDbType.Date).Value = DateTimePicker1.Value

        connection.Open()

        If command.ExecuteNonQuery() = 1 Then

            MessageBox.Show("Data Updated")

        Else

            MessageBox.Show("ERROR")

        End If

        connection.Close()

    End Sub
End Class
      
///////////////OUTPUT:

Update MySQL Data In VBnet




Share it:

database

How To Update MySQL Database Data In VB.Net

mysql

mysql database

update

Update MySQL Database Data Using VB.Net

VB.NET

VB.NET Update MySQL Database Data

Post A Comment:

0 comments: