TBD.my

Full Version: [help] RFID reader + vb.net connect MySQL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
assalamualaikum, sy masih baru lagi dgn teknologi RFID ni, dan juga penggunaan VB.net

knowledge pasal VB.net ni xde sgt.. so straight to the point sy ada beli RFID Reader + Tag dan juga dibekalkan dgn source code untuk baca ID number dlm tag tu..

screenshoot:
Spoiler:
[Image: 60HmtxW.png]

source code:
Code:
http://www.mediafire.com/download.php?4nglxcpufkvg75b
virus total:
Code:
https://www.virustotal.com/en/url/1628f39b3cd641647644c6669c80b4a5f5ae17d63c77a3c6dc0e07053a24ff17/analysis/1369030303/
ada detect 1 virus OMG OK


beli kat sini:
Code:
http://rfid.ecosensa.com/index.php/product/high-frequency/eco-hf-nfc-desktop-readerwriter

berminggu jugak stady pasal VB ni tapi since belajar sendiri susah nk faham code.. ada try refer kat forum ni tapi muncul bnyak error yg xreti nk fix..
Code:
http://forum.putera.com/tanya/index.php?/topic/91695-vb-data-to-mysql/

skang ni nk tambah code untuk connect to MySQL je problem.. ada sesiapa bole tolong? saya sanggup pergi jmpa korang (area selangor/KL) + upah sket..
sory noobs bertanya Kih3

RFID ni korang gna untuk ape?
Meh datang jumpa aku kalu berminat....tp skang nih weekdays amat sebuk sikit...tp kalu ko rajin dtg jmpa aku malam ada bran???

(20-05-2013, 03:50 PM)keyoren Wrote: [ -> ]sory noobs bertanya Kih3

RFID ni korang gna untuk ape?

example touch n go
@[JejakaPemalu] thx UGPM ^^
ko nak bt program untuk kedai sendiri :P
sume ni saya bole buat hnya gunakan notepad shj..xperlu guna vb net pon
(20-05-2013, 10:19 PM)tester Wrote: [ -> ]sume ni saya bole buat hnya gunakan notepad shj..xperlu guna vb net pon

Saudara, kawan-kawan baru nak belajar, mari kita sama-sama support tunjukkan jalan yang betul , jangan lari dari topik sebenar.
nak tnya..selalunya vb.net ni pakai database apa eh..yg boleh perform dengan baik? jenis database..or app database..
(21-05-2013, 10:48 AM)stranger12 Wrote: [ -> ]nak tnya..selalunya vb.net ni pakai database apa eh..yg boleh perform dengan baik? jenis database..or app database..
dude, stop hijjack others thread. U can create you own thread and ask.OK
(20-05-2013, 10:19 PM)tester Wrote: [ -> ]sume ni saya bole buat hnya gunakan notepad shj..xperlu guna vb net pon

acah2 je dia ni -,- org minta tolong , kita bantu dia .
thx kepada yg reply.. btw sambungan ke database mysql dah berjaya.. weeeeeee ^^
tapi ada janggal sket value yg dia masuk tu.. OK

screenshot:
Spoiler:

[Image: D4N3Eax.png]
[Image: uXSxzUD.png]
[Image: L969abw.png]


yang anehnya bila start je program value null dah masuk OK
then bila tukar kad pastu tekan request dia akan store value yg sebelumnya..

Code:
Option Strict Off
Option Explicit On
Imports VB = Microsoft.VisualBasic
Imports MySql.Data.MySqlClient
Friend Class frm_main
    Inherits System.Windows.Forms.Form
    Private Sub btnTestConnection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command1.Click
        Dim MysqlConn As MySqlConnection

        MysqlConn = New MySqlConnection()

        MysqlConn.ConnectionString = "server=localhost; user id=root; password=; database=pertama"
        Try
            MysqlConn.Open()
            MessageBox.Show("Connection to Database has been opened.")
            MysqlConn.Close()
        Catch myerror As MySqlException
            MessageBox.Show("Cannot connect to database: " & myerror.Message)
        Finally
            MysqlConn.Dispose()
        End Try
    End Sub
    Private Sub addToMySql_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command1.Click
        Dim MysqlConn As MySqlConnection
        Dim MysqlCommand As New MySqlCommand
        Dim queryNoID As String
        MysqlConn = New MySqlConnection()
        MysqlConn.ConnectionString = "server=localhost; user id=root; password=; database=pertama"
        queryNoID = "INSERT INTO tbl_noid (noID) VALUES (@noID);"
        Try
            MysqlCommand.Connection = MysqlConn
            MysqlCommand.CommandText = queryNoID
            MysqlCommand.Parameters.AddWithValue("@noID", tx_kh.Text)
            MysqlConn.Open()
            MysqlCommand.ExecuteNonQuery()
            MysqlConn.Close()
            MessageBox.Show("Rekod disimpan")
        Catch myerror As MySqlException
            MessageBox.Show("Gagal menyimpan rekod: " & Environment.NewLine & myerror.Message)
        Finally
            MysqlConn.Dispose()
        End Try
    End Sub
    Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click
        Dim port, i, baud As Integer
        Dim j As Short
        Dim buf1(200) As Byte
        Dim b1 As Byte
        Dim s1 As String
        port = cb_ckh.SelectedIndex + 1
        If (port = 0) Then
            lb_info.Text = "Please select COM Port!"
        End If
        baud = CInt(cb_btl.Text)
        If (baud = 0) Then
            lb_info.Text = "Please select Baud rate!"
        End If
        'Open Port
        i = rf_init_com(port, baud)
        If (i <> 0) Then
            lb_info.Text = "Open Port Fail!"
            Exit Sub
        End If
        'Request
        i = rf_request(0, &H52S, j)
        If (i <> 0) Then
            lb_info.Text = "Request Fail!"
            Exit Sub
        End If
        'Anticollision
        i = rf_anticoll(0, 4, buf1(0), b1)
        If (i <> 0) Then
            lb_info.Text = "Anticollision Fail!"
            Exit Sub
        End If
        s1 = ""
        For i = 0 To b1 - 1
            s1 = s1 & VB.Right("00" & Hex(buf1(i)), 2)
        Next i
        tx_kh.Text = s1
        'Select card
        i = rf_select(0, buf1(0), 4, b1)
        If (i <> 0) Then
            lb_info.Text = "Select card fail!"
            Exit Sub
        End If
        lb_info.Text = "Select card succeed!"
    End Sub



    Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command2.Click
        Dim i, m As Integer
        Dim buf1(200) As Byte
        Dim buf2(200) As Byte
        Dim s1 As String
        Dim b2, b1, b3 As Byte
        s1 = Trim(tx_key.Text)
        If (Len(s1) <> 12) Then
            lb_info.Text = "Wrong Key Length!"
            tx_key.Focus()
            Exit Sub
        End If
        For i = 0 To 5
            buf1(i) = Val("&H" & Mid(s1, i * 2 + 1, 2))
        Next i
        m = cb_kh.SelectedIndex
        If (m = -1) Then
            lb_info.Text = "Select Block Please!"
            Exit Sub
        End If
        If (op_a.Checked) Then
            b1 = &H60S
        End If
        If (op_b.Checked) Then
            b1 = &H61S
        End If
        b3 = CByte(m)
        'Authentication
        i = rf_M1_authentication2(0, b1, b3, buf1(0))
        If (i <> 0) Then
            lb_info.Text = "Authentication Fail£¡"
            Exit Sub
        End If
        'Read card
        i = rf_M1_read(0, b3, buf2(0), b2)
        If (i <> 0) Then
            lb_info.Text = "Read Card Fail!"
            Exit Sub
        End If
        s1 = ""
        For i = 0 To b2 - 1
            s1 = s1 & VB.Right("00" & Hex(buf2(i)), 2)
        Next i
        tx_sj.Text = s1
        lb_info.Text = "Read Succeed!"
    End Sub

    Private Sub Command3_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command3.Click
        Dim i, m As Integer
        Dim buf1(200) As Byte
        Dim buf2(200) As Byte
        Dim s1 As String
        Dim b1, b3 As Byte
        s1 = Trim(tx_key.Text)
        If (Len(s1) <> 12) Then
            lb_info.Text = "Wrong Key Length!"
            tx_key.Focus()
            Exit Sub
        End If
        For i = 0 To 5
            buf1(i) = Val("&H" & Mid(s1, i * 2 + 1, 2))
        Next i
        m = cb_kh.SelectedIndex
        If (m = -1) Then
            lb_info.Text = "Select Block Please!"
            Exit Sub
        End If
        If (op_a.Checked) Then
            b1 = &H60S
        End If
        If (op_b.Checked) Then
            b1 = &H61S
        End If

        s1 = Trim(tx_sj.Text)
        If (Len(s1) <> 32) Then
            lb_info.Text = "Wrong Data length "
            tx_sj.Focus()
            Exit Sub
        End If
        For i = 0 To 15
            buf2(i) = Val("&H" & Mid(s1, i * 2 + 1, 2))
        Next i
        'Authentication
        b3 = CByte(m)
        i = rf_M1_authentication2(0, b1, b3, buf1(0))
        If (i <> 0) Then
            lb_info.Text = "Authentication Fail!"
            Exit Sub
        End If
        'Write card
        i = rf_M1_write(0, b3, buf2(0))
        If (i <> 0) Then
            lb_info.Text = "Write Card Fail£¡"
            Exit Sub
        End If

        lb_info.Text = "Write Succeed!"
    End Sub


    Private Sub Command4_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command4.Click
        Dim i As Integer
        i = rf_halt(0)
        If (i <> 0) Then
            lb_info.Text = "Halt Fail!"
            Exit Sub
        End If
        lb_info.Text = "Halt Succeed"
    End Sub


    Private Sub frm_main_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
        Dim i As Integer
        For i = 0 To 63
            cb_kh.Items.Insert(i, CStr(i))
        Next i
        cb_ckh.SelectedIndex = 0 : cb_btl.SelectedIndex = 1 : cb_kh.SelectedIndex = 4
    End Sub
End Class

kalau boleh mau dia auto scan je bila kita touch..
SOLVED with virus detected..hampeh..satu hari aku forensik remove virus dalam windows aku..

http://paste.tbd.my/1190
http://paste.tbd.my/1189
(16-06-2013, 08:57 PM)JejakaPemalu Wrote: [ -> ]SOLVED with virus detected..hampeh..satu hari aku forensik remove virus dalam windows aku..

http://paste.tbd.my/1190
http://paste.tbd.my/1189

Thank you a lot of the ring my lord.. ;d hehe
baru saja selesai presentation.. everything work like charm.. awesome.. kalau nk pengeras pm me kay.. ^^