Popular Posts

VB.Net - Using MySQL Stored Procedure

Share it:

How To Use MySQL Database Stored Procedure In VbNet

Using MySQL DataBase Stored Procedure In VB.Net

In This VB.Net Tutorial  We Will See How To Call A Stored Procedure From MySQL DataBase To Insert Data In Visual Basic.Net  Programming Language And Visual Studio Editor.


Project Source Code:

Imports MySql.Data.MySqlClient

Public Class Using_MySQL_Stored_PROCEDURE

    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 params(2) As MySqlParameter

        params(0) = New MySqlParameter("FLNM", MySqlDbType.VarChar)
        params(0).Value = TextBoxName.Text

        params(1) = New MySqlParameter("ADRS", MySqlDbType.VarChar)
        params(1).Value = TextBoxAdrs.Text

        params(2) = New MySqlParameter("DT", MySqlDbType.Date)
        params(2).Value = DateTimePicker1.Value

        Dim cmd As New MySqlCommand()

        cmd.Connection = connection
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "Insert_Data"

        cmd.Parameters.AddRange(params)

        connection.Open()

        If cmd.ExecuteNonQuery() = 1 Then
            MessageBox.Show("Inserted")
        Else
            MessageBox.Show("Not Inserted")
        End If

        connection.Close()


    End Sub
End Class
      

///////////////OUTPUT:

Call MySQL DataBase Stored Procedure Using VB.Net




Share it:

database

How To Call MySQL Stored Procedure Using VB.Net

mysql

mysql database

Stored Procedure

stored Procedure VB.Net application

Using MySQL Stored Procedure In VB.Net

VB.NET

Post A Comment:

0 comments: