mysql - Combining two tables - database OLEDB -
i have 2 tables in 1 database file:
first table:
clientid firstname middlename lastname contactnum emailadd 200 xxxxx yyyyyy zzzzz 00000000 example@yahoo.com
second table:
employeeid firstname middlename lastname contactnum emailadd 100 xxxxx yyyyyy zzzzz 00000000 example@yahoo.com
how can connect it?
i tried using innerjoin there's wrong database or code?
objcomm = new oledbcommand("select tblclient.clientid, tbllawyer.employeeid tblclient inner join tbllawyer on tblclient.clientid = tbllawyer.employeeid", objconn) objadap = new oledbdataadapter(objcomm) objadap.fill(objdt) if objdt.rows.count > 0 dgregister.datasource = objdt dgregister.columns(0).visible = false objdt = new datatable objcomm = new oledbcommand("select tblclient.clientid, tbllawyer.employeeid tblclient inner join tbllawyer on tblclient.clientid = tbllawyer.employeeid employeeid=" & dgregister.rows(0).cells(0).value.tostring(), objconn) objadap = new oledbdataadapter(objcomm) objadap.fill(objdt) txtfirstname.text = objdt.rows(0)(1).tostring() txtmidname.text = objdt.rows(0)(2).tostring() txtlstname.text = objdt.rows(0)(3).tostring() txtcnumber.text = objdt.rows(0)(4).tostring() txtemail.text = objdt.rows(0)(5).tostring() txtpw.text = objdt.rows(0)(6).tostring() txtsex.text = objdt.rows(0)(7).tostring()
i'm trying display on datagridview. thanks
use union
:
select t1.* table1 t1 union select t2.* table2 t2
Comments
Post a Comment