Search the database


  • I have a code used to search in tables linked with some basic tables tb1 and table 2 tb2
    The code searches the IFFLITER but looks at the first table only and deletes the data for the second table to not appear with the SKIN code placed in the tables

    If IsNumeric(TextBox1.Text) = False Then Dim DataAdapter As New OleDbDataAdapter("SELECT * FROM tb1 WHERE tb1.clien_mail

    LIKE '" & Trim$(TextBox1.Text) & "%' or tb1.model_mail like '" & Trim$(TextBox1.Text) & "%'", con) con.Open() DataSet1.Clear() DataAdapter.Fill(DataSet1, "tb1,tb2") con.Close() If Me.BindingContext(DataSet1, "tb1,tb2").Count = 0 Then TextBox1.Text = "" con.Close() Exit Sub Else DataSet1.Clear() DataAdapter.Fill(DataSet1, "tb1,tb2") count() Exit Sub End If End If Catch ex As Exception MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try

    Tuesday, January 2, 2018 5:06 PM

All replies

  • What kind of database?

    Success Cor

    Tuesday, January 2, 2018 5:37 PM
  • Unless I'm missing something here, the DataAdapter Fill method does not take multiple tables as the second parmater as per this MSDN documentation. I think that is your problem.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Tuesday, January 2, 2018 5:53 PM
  • What is your question?

    Paul ~~~~ Microsoft MVP (Visual Basic)

    Wednesday, January 3, 2018 12:57 PM