hye fren...i'm using asp.net and sql express 2005 right now.....my problem is how i want to select 2 table from the database because i'm using a gridview......?anyone?thanks in advance.....

7 Years
Discussion Span
Last Post by hassan12345

Your question is vague. Do you want to select data from 2 tables for 2 controls? Do you want to join the tables? Inner or outer join? Are you looking for code, the SQL statement, or what? What do the tables look like? What information do you want from the tables?


sorry....i want to select data from 2 tables using 1 control button.i want to join the tables.i've tried some code but it stil error.....it goes direct to catch..

ok like this....i'll explain it to you......

1st table:penempahan
noRo(PK),tarikhRo,noPo,pecahanVott,idPemesan n idPembekal

2nd table:barangTempahan
noRo(PK),idBarang,kuantiti,jumlah,tempoh,status and catatan

i want to join this 2 tables and view it using one button in a gridview...
i want to select certain information....from table1:tarikhRo,idPemesan and idPembekal
from table2:idBarang,kuantiti,tempoh and status

please help me.....


still.....i cannot solve my problem.....i dont want to select all the data...i just want to select a few of them only.....i dont know how to select them in .cs because i'm using a gridview......so,i cannot select two tables in one gridview.....


:D:D:D:D You are Lame. Read Read read. http://www.w3schools.com/sql/sql_select.asp

Here you will find how to use SELECT Statements of SQL. It have examples like:

SELECT LastName,FirstName FROM Persons;

Persons - is the table;
LastName and FirstName - is columns in Persons table;

With this Statement you select all data from columns LastName and FirstName.

If you wish to take current data from current column look this and READ http://www.w3schools.com/sql/sql_select.asp


1st table empTb>>depno(FK)
2nd table deptTb>>depno(PK)

select e.empId,e.empName,e.depno,d.depName from empTb e,deptTb d
where e.depno=d.depno;

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.