What is wrong here
8 posts
Page 1 of 1
Code: Select all
Getting this errorPrivate Sub searchbox_TextChanged(sender As System.Object, e As System.EventArgs) Handles searchbox.TextChanged
If searchby.Text = "Username" Then
searchstr = "SELECT accountinfo.fname, accountinfo.lname, accounts.EMail " & _
"FROM accountinfo WHERE Username like '%" & searchbox.Text & "%'"
ElseIf searchby.Text = "Email" Then
searchstr = "SELECT * FROM accounts WHERE EMail like '%" & searchbox.Text & "%'"
ElseIf searchby.Text = "Last Name" Then
searchstr = "SELECT * FROM accountinfo WHERE lname like '%" & searchbox.Text & "%'"
ElseIf searchby.Text = "Phone" Then
searchstr = "SELECT * FROM accountinfo WHERE phone like '%" & searchbox.Text & "%'"
End If
Dim fname, lname, EMail
CONNECTION.Open()
cmd = New MySqlCommand(searchstr, CONNECTION)
dr = cmd.ExecuteReader()
ListView1.Items.Clear()
Do While dr.Read()
fname = (dr.Item("fname").ToString())
lname = (dr.Item("lname").ToString())
EMail = (dr.Item("EMail").ToString())
Dim lv As ListViewItem = ListView1.Items.Add(fname)
lv.SubItems.Add(lname)
lv.SubItems.Add(EMail)
Loop
dr.Close()
CONNECTION.Close()
cmd.Dispose()
End Sub
mysql tables are accounts and accountinfo
accounts as the EMail in it
and accountinfo as fname and lname
Last edited by Kobra1984 on Wed Dec 14, 2011 11:07 pm, edited 2 times in total.
ohh well there should be a data source somewhere i would think and whats the error there is no error in that just code
Check capitalization then if i were you or change field name
PS Plz look and comment on my program
viewtopic.php?f=38&p=59866#p59866
PS Plz look and comment on my program
viewtopic.php?f=38&p=59866#p59866
Do you have a column named EMail in the accounts table?
Does the error occur when searching in a specific column?
The error message does not show enough information.
Does the error occur when searching in a specific column?
The error message does not show enough information.
8 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023