- Step 1: Create New Project use VB 2013
- Step 2 :Create database and table in MySQL
- Step 3 : Design form in VB .Net 2013
Make sure you already install VB 2013 in your computer
See also : How to connect DB Access in VB NET 2013
Open Visual Studio 2013
Click Visual Studio 2013
Click File - New - Project
after that like below picture :
Click OK
After that, please follow STEP 2
#Step 2 :
Create Database in MySQL (Xampp) with name of database = mydb
Create table = TBL_PRODUCT
Fill sample data in TBL_PRODUCT
#Step 3
Open your VB 2005 Application
Design form1 like below picture :
Just add "Datagridview1" in Form1
Place below code at Form1
Imports System.Data.Odbc
Public Class Form1
Dim Conn As OdbcConnection
Dim da As OdbcDataAdapter
Dim ds As DataSet
Dim str As String
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) _
Handles MyBase.Load
Me.Text = "www.belajarvb.com"
Koneksi()
da = New OdbcDataAdapter("Select * from TBL_PRODUCT", Conn)
ds = New DataSet
ds.Clear()
da.Fill(ds, "TBL_PRODUCT")
DataGridView1.DataSource = (ds.Tables("TBL_PRODUCT"))
End Sub
Sub Koneksi()
str = "Driver={MySQL ODBC 3.51 Driver};database=mydb;server=localhost;uid=root"
Conn = New OdbcConnection(Str)
If Conn.State = ConnectionState.Closed Then
Conn.Open()
End If
End Sub
End Class
Please click here to download project / source code above and Stay tuned for our next lesson :)
Next Article
« Prev Post
« Prev Post
Previous Article
Next Post »
Next Post »
Penulisan markup di komentar
- Untuk menulis huruf bold silahkan gunakan
<strong></strong>
atau<b></b>
. - Untuk menulis huruf italic silahkan gunakan
<em></em>
atau<i></i>
. - Untuk menulis huruf underline silahkan gunakan
<u></u>
. - Untuk menulis huruf strikethrought silahkan gunakan
<strike></strike>
. - Untuk menulis kode HTML silahkan gunakan
<code></code>
atau<pre></pre>
atau<pre><code></code></pre>
, dan silahkan parse dulu kodenya pada kotak parser di bawah ini.
Konversi Code
Silahkan Berkomentar Dengan