First You Must Download ODBC 5.2w at http://dev.mysql.com/downloads/connector/odbc/
Next Open Your ODBC

And click Add
11

Next click MYSQL ODBC 5.2w Driver
21

Click Finish And
31
Click OK and Click OK Again

Creating Your MYSQL
Create Database With Name data
Create Table with name user_data
CREATE TABLE user_data(
useridINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
name CHAR(20) NOT NULL,
username CHAR(20) NOT NULL,
pass CHAR(20) NOT NULL
);

Oke Next Open Your Visual Basic 6 Standart Exe

Create Form Like This
1 Command Button (cmdOK)
3 Label (Nama,Username,Password)
3 Text Box (name,username,pass)

1321760_20121012030126

And Double Click cmdOK
insert Script Like This

Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset

Private Sub cmdOK_Click()
If Text1.Text = "" Then
MsgBox ("Masukan Nama Anda")
Else
If Text2.Text = "" Then
MsgBox ("Masukan Username")
Else
If Text3.Text = "" Then
MsgBox ("Masukan Password")
Else
conn.Execute "INSERT INTO user_data(name, username, pass,) VALUES('" & Name.Text & "','" & username.Text & "','" & pass.Text & "')", , adExecuteNoRecords
End If
End If
End If
MsgBox (" Register Anda Berhasil ")
End Sub

Private Sub Form_Load()
Set conn = New ADODB.Connection
conn.CursorLocation = adUseClient 'SERVER-SIDE NOT RECCOMENDED
conn.ConnectionString = "DRIVER={MySQL ODBC 5.2w Driver};" _
& "SERVER=localhost;" _
& "DATABASE=data;" _
& "UID=root;" _
& "PWD=pass;" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 163841 'SET ALL PARAMETERS
conn.Open 'THESE OPTION VALUES ARE BEST FOR VB



Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM user_data", conn, adOpenStatic, adLockReadOnly
End Sub

Oke Good Luck And Good Bye

AndreRet commented: Read my comments below. +12

Thank you for posting a tutorial here. :)

You do however need to make sure that all of your code and setup data is correct...

You have created 3 text boxes named nama, username and pass yet in your code you have Text1, Text2 etc. You have also closed your end if statements at the end...

You need to use english to make the post understandable for all globally...

For other users wanting to do a proper setup on mysql, server etc. read my tutorial HERE.

We hope to see more of you here at vb6 forum - Daniweb haviansyah. :)

Hai Haviansyah..
As andre said that your code is not consistent.
Ex when you use text1 instead of Name.
But we really appreciate your post and hope many posts from you. :)

*NB : Pake bhs inggris ya bro,,forum internasional nih,,hehe,,semua comment n bhs harus inggris,,ntar pada komentar,,kdg ada admin yg mrh kalo bukan bhs ing.. see u soon bro :)

commented: Long time no hear ;) +12
commented: :D +0

error for me :( but thanks for the idea of using INSERT INTO codes :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.