Спасибо
Код:
- Код: Выделить всё
Imports MySql.Data.MySqlClient
Imports System.Data
Public Class frmLogin
Dim conn As MySqlConnection
Dim myCommand As New MySqlCommand
Dim cmd As MySqlCommand
Dim sql As String
Dim reader As MySqlDataReader
Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click
Application.Exit()
End Sub
Private Sub ShowValue()
sql = "SELECT bill, familiya_otvetst, name_otvetstven FROM billing_accouting LIMIT 50"
Try
conn.Open()
cmd = New MySqlCommand(sql, conn)
reader = cmd.ExecuteReader()
ListView1.Items.Clear()
While reader.Read()
With ListView1.Items.Add(reader.Item(0)).Subitems
.Add(reader.Item(1))
.Add(reader.Item(2))
End With
End While
reader.Close()
cmd.Dispose()
conn.Close()
Catch ex As Exception
MsgBox("Нет соединения с базой" & vbCrLf & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Public Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
conn = New MySqlConnection()
conn.ConnectionString = "server=" & txtServer.Text & ";" _
& "user id=" & txtUsername.Text & ";" _
& "password=" & txtPassword.Text & ";" _
& "database=radius"
ShowValue()
End Sub
Private Sub ListView1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseClick
'MsgBox(ListView1.Show)
MsgBox(ListView1.SelectedItems.Item(0).Text)
MsgBox(ListView1.SelectedItems.Item(0).SubItems(1).Text)
End Sub
Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
System.Text.Encoding.GetEncoding(1251)
End Sub
End Class