mysql - How to search data in all tables in database using select query in vb.net? -


how search data in tables in database using select query in vb.net? here code:

try     mysqlconn.open()      dim query string     query = "select *  (item_description '%" & textbox11.text & "%' or vendor '%" & textbox11.text & "%' or s_n '%" & textbox11.text & "%' or tag_num '%" & textbox11.text & "%')"     command = new mysqlcommand(query, mysqlconn)     sda.selectcommand = command     sda.fill(dbdataset)     bsource.datasource = dbdataset     datagridview1.datasource = bsource     sda.update(dbdataset)     mysqlconn.close()  catch ex exception      mysqlconn.dispose() end try 

sorry ana don't think can leave out table name in clause. if want search 30 different tables (that have same columns...?) you'd have iterate on each 1 of them separately , join information yourself

you each (table name) loop data each table. adapter adds new information datatable have 1 datatable in end results 30 tables.

dim query string dim dt new datatable each tablename in (tablenamelist)      query = "select * " & tablename & " (item_description '%" & textbox11.text & "%' or vendor '%" & textbox11.text & "%' or s_n '%" & textbox11.text & "%' or tag_num '%" & textbox11.text & "%')"     command = new mysqlcommand(query, mysqlconn)     sda.selectcommand = command     sda.fill(dt) next 

where tablenamelist list of datatable names. job done, there many improvements made here.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -