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.....

Recommended Answers

All 7 Replies

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.....

I try to help but I`m not guru. You can use two SELECT request when you Click on current Button, the first will be something like this:
SELECT * FROM penempahan;
Second request can be:
SELECT * FROM barangTempahan;

You can look and this http://www.w3schools.com/sql/sql_select.asp

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;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.