can you help me to fix this code??
i made that one but there's a problem in searching once you enter the form it just paste all the reservation. but i need to be categorize by name, address, roomtype and email
Imports MySql.Data.MySqlClient
Public Class search
Public conn As New MySqlConnection
Dim selected_row, count As String
Private Sub search_load(ByVal server As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If conn.State = ConnectionState.Closed Then
conn.ConnectionString = "SERVER = localhost; USERID = root; PASSWORD =; DATABASE = kahuna "
End If
LoadPeople()
End Sub
Public Function WithDrawal(ByVal Amount As Decimal, _
ByVal TransactionCode As Byte) As Double
' Add code here to perform the withdrawal,
' return a transaction code,
' or to raise an overdraft error.
End Function
Public Sub LoadPeople()
Dim sqlQuery As String = "SELECT * FROM reservation"
Dim sqlAdapter As New MySqlDataAdapter
Dim sqlcmd As New MySqlCommand
Dim TABLE As New DataTable
Dim i As Integer
With sqlcmd
.CommandText = sqlQuery
.Connection = conn
End With
With sqlAdapter
.SelectCommand = sqlcmd
.Fill(TABLE)
End With
For i = 0 To TABLE.Rows.Count - 1
With lvresult
.Items.Add(TABLE.Rows(i)("Number"))
With .Items(.Items.Count - 1).SubItems
.Add(TABLE.Rows(i)("RoomType"))
.Add(TABLE.Rows(i)("Name"))
.Add(TABLE.Rows(i)("Location"))
.Add(TABLE.Rows(i)("Email"))
.Add(TABLE.Rows(i)("Phone"))
.Add(TABLE.Rows(i)("NoGuest"))
.Add(TABLE.Rows(i)("NoRoom"))
.Add(TABLE.Rows(i)("BookingType"))
.Add(TABLE.Rows(i)("Payment"))
.Add(TABLE.Rows(i)("ADate"))
.Add(TABLE.Rows(i)("DDate"))
.Add(TABLE.Rows(i)("Message"))
End With
End With
Next
End Sub
' Private Sub btn_search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_search.Click
'Select Case Me.cmb_search.Text
'Case "by Name"
'Me.txb_search.Enabled = True
'Me.txb_search.BringToFront()
'Dim comm_sender As New MySqlCommand("SELECT * FROM Name WHERE `Sender` LIKE '%" & Me.txb_search.Text & "%'", conn)
'Dim rdr As MySqlDataReader = comm_sender.ExecuteReader
'Dim number, roomtype, pangalan, lugar, email, contact, guest, room, book, payment, adate, ddate, messsage As String
'delete the contain documents
'Me.lvresult.Rows.Clear()
'--------------------------------------
'read command then access data to display
'While rdr.Read
'number = rdr.Item("Number")
'roomtype = rdr.Item("RoomType")
'pangalan = rdr.Item("Name")
'lugar = rdr.Item("Location")
'email = rdr.Item("Email")
'contact = rdr.Item("Phone")
'guest = rdr.Item("NoGuest")
'room = rdr.Item("NoRoom")
'book = rdr.Item("BookingType")
'payment = rdr.Item("Payment")
'adate = rdr.Item("ADate")
'ddate = rdr.Item("DDate")
'messsage = rdr.Item("Message")
'Me.lvresult.rows.Add(number, roomtype, pangalan, lugar, email, contact, guest, room, book, payment, adate, ddate, messsage)
'count = Me.lvresult.Rows.Count
'
' If count = 0 Then
' Me.Label1.Text = "No document/s found."
' Else
' Me.Label1.Text = count - 1 & " " & "document/s found."
' End If
' End While
' End Select
'End Sub
End Class
hope somebody can help me