在vb.net datagrid视图中选择多个表sql --sql& vb.net

时间:2017-03-13 18:49:52

标签: mysql vb.net

我正在尝试在mysql中选择多个表,然后将其返回到我的应用程序的datagridview。下面的SQL查询不起作用。 sql是错的吗?我有两个名为" bruker" &安培; " blodgiver"在mysql中

Dim searchQuery As String = "SELECT bruker INNER JOIN blodgiver WHERE CONCAT(bruker_id, fornavn, etternavn, epost, personnummer) like '%" & valueToSeach & "%'"

Dim command As New MySqlCommand(searchQuery, MysqlConn)
Dim adapter As New MySqlDataAdapter(command)
Dim table As New DataTable()

adapter.Fill(table)

DataGridView1.DataSource = table

1 个答案:

答案 0 :(得分:0)

你必须提供on条款。

SELECT * FROM bruker br INNER JOIN blodgiverbd on bd.<link_column1> = db.<link_column2>  WHERE CONCAT(bruker_id, fornavn, etternavn, epost, personnummer) like '%" & valueToSeach & "%'"