Start New Discussion within our Software Development Community

Hello again,

I am trying to set a filter button into my application and I need a little bit of help.. Acually I want the user enter the city of the customers (etc:Brampton-Ontario ) and the program prints out the customers of the ontario. If there aren't any records to print out a message. Below it's my code the program prints out the columns of city so that confused me.. Any ideas appreciate.!!!

Dim DataAdapter1 As MySqlDataAdapter = New MySqlDataAdapter()
Dim sql4 As MySqlCommand = New MySqlCommand("SELECT City FROM customers = " & citytxt.Text, SQLConnection)
Dim source1 As New BindingSource()
Dim ds As DataSet = New DataSet()


        If citytxt.Text = "" Then
            MessageBox.Show("Error.Please fill the city or the mobile field", "Error Input.!", MessageBoxButtons.OK, MessageBoxIcon.Error)

        Else


            DataAdapter1.SelectCommand = sql4  ''database load 
            DataAdapter1.Fill(ds, "customers")   ''dataset 

            source1.Filter = "customers = '" & citytxt.Text & " '"
            datagrid1.DataSource = ds
            datagrid1.DataMember = "customers"     ''DATAGRIDVIEW Load data sources and datamember 


            datagrid1.Refresh()

            SQLConnection.Close()   ''closing/refreshing the connection

Thank you in advance..!!
Regards

Actually i dont know very well MySQL. But i can give you MSSQL string.
Basically you want to get customers' name who are in a particular city?

SELECT coustomerName FROM customers Where city = " & citytxt.Text & "

This article has been dead for over six months. Start a new discussion instead.