I am new in VB.NET. Can any tell me how a richtextbox query MySQL table.
i.e select * from table test where name= 'Bowser'

then the richtextbox will display the results.

Thank you!

show us your code friend..

here is the code so far, I have made MySQL connection working. now need to do the query display result on richtextbox.

----------------------------------

Private Sub cmdLogin_Click_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin1.Click
        conn = New MySqlConnection()
        conn.ConnectionString = "server=" & TextBox1.Text & ";" _
     & "user id=" & TextBox2.Text & ";" _
    & "password=" & TextBox3.Text & ";" & "database=test"
        Try
            conn.Open()
            MessageBox.Show("Connection Opened Successfully")
            conn.Close()
        Catch myerror As MySqlException
            MessageBox.Show("Error Connecting to Database: " & myerror.Message)
        Finally
            conn.Dispose()
        End Try
    End Sub

    Private Sub RichTextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox4.TextChanged

    End Sub
End Class

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

Now, you have to configure MySqlCommand object to execute select query against that database connection.

conn = New MySqlConnection()
   conn.ConnectionString = "server=" & TextBox1.Text & ";" _
     & "user id=" & TextBox2.Text & ";" _
    & "password=" & TextBox3.Text & ";" & "database=test"
        Try
            conn.Open()
            Dim cmd as New MySqlCommand("select colName1 from TableName where ColName2=1",cn)
            Dim obj as object
            obj=cmd.ExecuteScalar()
            conn.Close()

            IF IsNothing(obj) then
                   MsgBox ("Not found")
            ELSE
                 RichTextBox4.Text=obj.ToString()
            End IF
        Catch myerror As MySqlException
            MessageBox.Show("Error Connecting to Database: " & myerror.Message)
        Finally
            conn.Dispose()
        End Try

PS: Please read this article - http://msdn.microsoft.com/en-us/library/h43ks021%28VS.71%29.aspx

This question has already been answered. Start a new discussion instead.