VB.NET Using RadioButton With MySQL - Hallo sahabat Dev-Create, Pada Artikel yang anda baca kali ini dengan judul VB.NET Using RadioButton With MySQL, kami telah mempersiapkan artikel ini dengan baik untuk anda baca dan ambil informasi didalamnya. mudah-mudahan isi postingan
Artikel insert radiobutton value in mysql database using vb.net,
Artikel mysql,
Artikel mysql database,
Artikel radio button,
Artikel radiobutton,
Artikel vb.net,
Artikel VB.NET Using RadioButton With MySQL, yang kami tulis ini dapat anda pahami. baiklah, selamat membaca.
Judul : VB.NET Using RadioButton With MySQL
link : VB.NET Using RadioButton With MySQL
Anda sekarang membaca artikel VB.NET Using RadioButton With MySQL dengan alamat link https://dev-create.blogspot.com/2017/12/vbnet-using-radiobutton-with-mysql.html
Judul : VB.NET Using RadioButton With MySQL
link : VB.NET Using RadioButton With MySQL
VB.NET Using RadioButton With MySQL
How To Use A Radio Button With MySQL Database In VbNet
In This VB.Net Tutorial We Will See How To Use A RadioButton Control With MySQL Database
- get value from the selected redio button and insert it into database .
- get value from mysql and select the specific radiobutton
In Visual Basic.Net Programming Language And Visual Studio Editor.
- get value from the selected redio button and insert it into database .
- get value from mysql and select the specific radiobutton
In Visual Basic.Net Programming Language And Visual Studio Editor.
PART 1
PART 2
Project Source Code:
Imports MySql.Data.MySqlClient
Public Class RadioButton_And_MySQL
Dim connection As New MySqlConnection("datasource=localhost;port=3306;username=root;password=;database=test")
Private Sub ButtonInsert_Click(sender As Object, e As EventArgs) Handles ButtonInsert.Click
Dim command As New MySqlCommand("INSERT INTO `users`(`username`, `Lang`) VALUES (@usn,@lng)", connection)
command.Parameters.Add("@usn", MySqlDbType.VarChar).Value = TextBoxUsername.Text
Dim rdb As String = ""
' get selected radio button
If RdbCsharp.Checked = True Then
rdb = "C#"
ElseIf RdbVbnet.Checked = True Then
rdb = "VB.NET"
ElseIf RdbJava.Checked = True Then
rdb = "Java"
Else
' NONE is the default
rdb = "NONE"
End If
command.Parameters.Add("@lng", MySqlDbType.VarChar).Value = rdb
connection.Open()
If command.ExecuteNonQuery() = 1 Then
MessageBox.Show("Inserted")
Else
MessageBox.Show("Not Inserted")
End If
connection.Close()
RdbCsharp.Checked = False
RdbJava.Checked = False
RdbVbnet.Checked = False
RdbNone.Checked = False
End Sub
' search data and check the radiobutton with the same value as the returned one
Private Sub ButtonGET_Click(sender As Object, e As EventArgs) Handles ButtonGET.Click
Dim adapter As New MySqlDataAdapter("SELECT * FROM `users` WHERE `id` = " & Convert.ToInt16(TextBoxID.Text), connection)
Dim table As New DataTable()
adapter.Fill(table)
TextBoxUsername.Text = table(0)(1)
If table(0)(2).Equals("C#") Then
RdbCsharp.Checked = True
ElseIf table(0)(2).Equals("VB.NET") Then
RdbVbnet.Checked = True
ElseIf table(0)(2).Equals("Java") Then
RdbJava.Checked = True
Else
RdbNone.Checked = True
End If
End Sub
End Class
///////////////OUTPUT:
Demikianlah Artikel VB.NET Using RadioButton With MySQL
Sekianlah artikel VB.NET Using RadioButton With MySQL kali ini, mudah-mudahan bisa memberi manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel lainnya.
Anda sekarang membaca artikel VB.NET Using RadioButton With MySQL dengan alamat link https://dev-create.blogspot.com/2017/12/vbnet-using-radiobutton-with-mysql.html