Private Sub updateList(ByVal query As String)
Dim con As SqlConnection = New SqlConnection("Data Source=DESKTOP-NFIARU8\SQLEXPRESS ; Database = CMS; Integrated Security = True")
Dim command As SqlCommand = con.CreateCommand()
con.Open()
command.CommandText = "SELECT account_id, account_name, account_type FROM account WHERE account_type in (0,1) AND (account_name LIKE @query OR account_phone LIKE @query) ORDER BY account_type"
command.Parameters.AddWithValue("@query", query + "%")
Dim reader As SqlDataReader = command.ExecuteReader()
listBox1.Items.clear()
While reader.Read
listBox1.Items.Add(New account(reader.GetInt32(0), reader.GetString(1), reader.GetInt32(2)))
con.Close()
End While
Asked
Active
Viewed 23 times
-2
Brian M Stafford
- 7,875
- 2
- 17
- 24