Imports MySql.Data.MySqlClient
Imports System.Data
Public Class frmMain
Dim strUser As String
Dim objConn As New MySqlConnection
Dim objCmd As New MySqlCommand
Dim dtAdapter As MySqlDataAdapter
Dim dt As New DataTable
Public Property _strUser() As String
Get
Return strUser
End Get
Set(ByVal value As String)
strUser = value
End Set
End Property
Public Shared Function ByteArrayToImage(ByVal byteArrayIn As Byte()) As Image
Dim ms = New System.IO.MemoryStream(byteArrayIn)
Dim returnImage As Image = Image.FromStream(ms)
Return returnImage
End Function
Public Sub LoadInfor()
'Dim myRow As DataRow = dt.Rows(0)
'Dim MyImage As Byte()
'Dim MyRow As DataRow
Dim strConnString, strSQL As String
strConnString = "Server=localhost;User Id=root; Password=0000; Database=members;"
objConn.ConnectionString = strConnString
objConn.Open()
strSQL = "SELECT * FROM member WHERE Username = '" & strUser & "' "
dtAdapter = New MySqlDataAdapter(strSQL, objConn)
dtAdapter.Fill(dt)
If dt.Rows.Count > 0 Then
Me.lblUser.Text = strUser
Me.lblName.Text = dt.Rows(0)("Name")
Me.lblEmail.Text = dt.Rows(0)("Email")
Me.lblAge.Text = dt.Rows(0)("Age")
Me.lblID.Text = dt.Rows(0)("CustomerID")
Me.lblGade.Text = dt.Rows(0)("Gade")
Me.lblWicha.Text = dt.Rows(0)("Wicha")
Me.lblClass.Text = dt.Rows(0)("Class")
Me.lblIdcard.Text = dt.Rows(0)("Idcard")
Me.lblRg.Text = dt.Rows(0)("Rg")
Me.lblNick.Text = dt.Rows(0)("Nick")
PictureBox3.Image = ByteArrayToImage(dt.Rows(0)("Pic"))
'Dim myBlob() As Byte = dt.Rows(0)("Pic")
'MyImage = CType(dt.Rows(0)("Pic"), Byte())
Me.RichTextBox1.Text = dt.Rows(0)("Adress")
Me.lblStats.Text = dt.Rows(0)("Stats")
Me.lblFt.Text = dt.Rows(0)("Father")
Me.lblMt.Text = dt.Rows(0)("Mother")
Me.lblWut.Text = dt.Rows(0)("Wut")
Me.lblEnd.Text = dt.Rows(0)("End")
Me.lblGade1.Text = dt.Rows(0)("Gade1")
Me.lblGade2.Text = dt.Rows(0)("Gade2")
Me.lblGade3.Text = dt.Rows(0)("Gade3")
Me.lblFace.Text = dt.Rows(0)("Face")
Me.lblLine.Text = dt.Rows(0)("Line")
Me.lblPhone.Text = dt.Rows(0)("Phone")
Me.lblStat.Text = dt.Rows(0)("Stat")
End If
objConn.Close()
objConn = Nothing
End Sub