Announcement

Collapse
No announcement yet.

How do I populate mysql field with textbox string

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I populate mysql field with textbox string

    Howdy all....

    I still have my stablisers on as far as vb.net and mysql are concerned. What I am trying to do is populate a status field within mysql with the content from a textbox in vb.net. I have my link working as I have populated a combo box from the same table but I cant work out how to do it the other way.

    Answers on a postcard or preferably in a box below.

    Thanks loads

  • #2
    Re: How do I populate mysql field with textbox string

    Just to elaborate on this a little. I have a combo box which populates from a mysql table. I then populate a textbox with "some text" from a button. Then what I am trying to do is populate the relative field "status" for the selected name from the combo box within the mysql db.

    Confused? Sorry

    Comment


    • #3
      Re: How do I populate mysql field with textbox string

      So you get data from the database to populate the combo box, but want to save the text entered on the form to the database?

      Where you use a SELECT to fetch data, use INSERT or UPDATE as appropriate to write back.
      Gareth Howells

      BSc (Hons), MBCS, MCP, MCDST, ICCE

      Any advice is given in good faith and without warranty.

      Please give reputation points if somebody has helped you.

      "For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

      "Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.

      Comment


      • #4
        Re: How do I populate mysql field with textbox string

        Thanks I do get that, the problem occurs when I am trying to change the code to achieve the INSERT. Here is my get code:

        Dim sStmt As String = "SELECT CONCAT (firstname, "" "", surname) AS FullName FROM phonebook"

        Dim da As New MySqlDataAdapter(sStmt, con)
        Dim dt As New DataTable("table")
        da.Fill(dt)

        If dt.Rows.Count > 0 Then
        ComboBox1.DisplayMember = "FullName"
        ComboBox1.DataSource = dt
        End If

        Am I correct in thinking the Dim da As New MySqlDataAdapter(sStmt, con) handles the actual data? After that I am stuck as to how to tell the code to write to the specific field based on the result of the combo box?

        Appreciate your patience - Im not the quickest when it comes to vb.net & mysql

        Comment

        Working...
        X