database - SQL Select statement --- more than 1 table and specific rows in select statement -


i know right way select more 1 table in database in select statement? i'm trying code executes both, first select statemnts gets rewriten second `

        con.open();         ds.clear();         da.selectcommand = new sqlcommand("select id, username, ime, prezime student", con);         da.selectcommand.executenonquery();          da.selectcommand = new sqlcommand("select odjel, smjer studij", con);         da.selectcommand.executenonquery();         da.fill(ds);          dg.datasource = ds.tables[0];          con.close();` 

i have been trying using , between tables doesnt work

        con.open();         ds.clear();          da.selectcommand = new sqlcommand("select id, username, ime, prezime student , odjel, smjer studij", con);                 da.fill(ds);          dg.datasource = ds.tables[0];          con.close(); 

i don't have need use whole table, rows, --> select * student, studij <--- won't me good. how can select multiple database tables display in datagrid?

the answer using

      "select table1.name, table2.id table1, table2"     or example        da.selectcommand = new sqlcommand("select student.ime, student.prezime, studij.odjel, studij.smjer student, studij", con); 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -