
Every time I programmed database system with Visual Basic, I always put MySQL version on status bar so that I always reminded to upgrade MySQL server. To create it, you just need to create a simple procedure.
This is the tutorial:
1. Bring your Visual Basic to design mode first, open your MDI form so that you can edit the status bar properties. To open status bar property pages, right click the status bar and then click Properties menu.

2. In Property Pages, click Panels tab, insert new panel by click Insert Panel button, set Minimum Width to at least 2500 then click OK button. Don’t forget to watch the index of panel.

3. Then write this script in your MDI main form or you can also write it on module.
Private Sub versi_server()
Dim rs_versi As New ADODB.Recordset
Dim str_versi As String
'/string sql
On Error GoTo versi_server_Error
str_versi = "SELECT VERSION() AS versi"
'/open recordset
With rs_versi
.CursorLocation = adUseClient
.Open str_versi, myconn, adOpenStatic, adLockReadOnly
StatusBar1.Panels(8).Text = "MySQL " & .Fields("versi")
StatusBar1.Panels(10).Text = "Connected"
'Call set_lampu_connect(1)
End With
Set rs_versi = Nothing
'-----------------------------------------------------------------
On Error GoTo 0
Exit Sub
versi_server_Error:
MsgBox "Got error ! " & vbCrLf & "Error number : " & Err.Number & vbCrLf & "Deskripsi : " & Err.Description & vbCrLf & "in procedure versi_server in [Form]->frmutama”
End Sub

4. After you write it (you can copy paste my script above), call it (versi_server procedure) on Form_Load procedure to load it every time your MDI main is loaded.
(article no:0032)


















No Comment Received
Leave A Reply