0

Now, i have Set up the Connection to MySQL,and i have this Layout:

|ID|Class|Name|Password|

The Names are ALL shown in Combobox2.But i have a Combobox1 with Numbers.Now if i select 1, i want only the Users with Class 1 to show in my Combobox2,when i Select 2, only Class 2 and so on. Also, i want the Programm to check the Password. What could i use to make this all happen? I also have a DataGridView if it helps. My code:

Dim conn As New MySqlConnection
        Dim myConnectionString As String
        myConnectionString = "server=127.0.0.1;uid=root;pwd=banana;database=kinder; "
        conn.ConnectionString = myConnectionString
        Try
            conn.Open()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        Dim com As String = "Select * from kind"
        Dim Adpt As New MySqlDataAdapter(com, conn)
        Dim ds As New DataSet()
        Adpt.Fill(ds, "kind")
        DataGridView1.DataSource = ds.Tables(0)
        Dim strSQL As String = "SELECT name FROM kind"
        With ComboBox2
            .DataSource = ds.Tables("kind")
            .DisplayMember = "name"
            .SelectedIndex = 0
        End With           

Thx in Future

2
Contributors
3
Replies
24
Views
8 Months
Discussion Span
Last Post by Sponge_1
0

Hi! Sponge_1
to do that first you have to fill combobox1 with class field of your database.
Then search your database on selection of class from combobox1 and you have to do this withen Combobox1.SelectionChange Event.

0

But i never integrated MySQL before.can you give me a example Snippet of code?

0

Also,i have duplicate classes,because there are multiple users in a class.how to fix that?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.