Popular Posts

VB.Net Delete MySQL Data

Share it:

How To Remove Data From MySQL Database Using VbNet

VB.Ne Andt MySQL Delete

In This VB.Net Tutorial  We Will See How To Delete The Selected Data From MySQL DataBase Table Using TextBox For The ID  To Just Remove 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 Delete_MySQL_Data

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

    Private Sub ButtonDelete_Click(sender As Object, e As EventArgs) Handles ButtonDelete.Click

        Dim command As New MySqlCommand("DELETE FROM `student` WHERE `Id` = @id", connection)

        command.Parameters.Add("@id", MySqlDbType.Int64).Value = TextBox1.Text

        connection.Open()

        Try

            If command.ExecuteNonQuery() = 1 Then

                MessageBox.Show("Data Deleted")

            Else

                MessageBox.Show("Error")

            End If

        Catch ex As Exception

            MessageBox.Show("Something Wrong")

        End Try


        connection.Close()

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

delete data from mysql database using vb.net




Share it:

database

delete

How To Delete Data From MySQL Database By ID in VB.Net

How To Delete Data From MySQL Database Using Vb.Net

mysql

mysql database

VB.NET

VB.Net Delete MySQL Data

Post A Comment:

0 comments: