dcsimg
query
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   harsha_govindaraju
Posted On:   Thursday, March 29, 2001 09:06 PM

Sir, I am using jdbc and swing. I want to retrieve data from more than one table at a time, I want to select data (primary key)from one table and place it in another table(ie just to display) TABLE1: Tankno(PK) Capacity Item contained Opendate Itemno(FK) TABLE2: Itemno(PK) Itemname cost I want to select ITEMNO from Table2 where ITEMNAME of Table2 should match with ITEMCONTAINED of Table1 and display it in TextField (ITEMNO) of Table1. I am getting this exception. [Microsoft][ODBC Driver Manager] Invalid cursor state. What to do to get rid of this Please help me by sending code. THANKIN   More>>

Sir,
I am using jdbc and swing.
I want to retrieve data from more than one table at a time, I want to select data (primary key)from one table and place it in another table(ie just to display)

TABLE1:
Tankno(PK) Capacity Item contained Opendate Itemno(FK)


TABLE2:
Itemno(PK) Itemname cost


I want to select ITEMNO from Table2 where ITEMNAME of Table2 should match with ITEMCONTAINED of Table1 and display it in TextField (ITEMNO) of Table1.

I am getting this exception.

[Microsoft][ODBC Driver Manager] Invalid cursor state.

What to do to get rid of this

Please help me by sending code.


THANKING YOU

HARSHA.H.G

   <<Less

Re: query

Posted By:   Anonymous  
Posted On:   Friday, March 30, 2001 02:08 PM

Well, as far as the Invalid cursor state exception is concerened, you are not calling rs.next() method after retrieving your ResultSet rs. Be sure to call this method before trying to get any data from it.


Secondly, if you want to get data from more than one table then you can simply join them and get all the data. For example:


Suppose you have a table employee_info (emp_no, emp_name, emp_addr)and employee_status (emp_no, emp_status), then you can join then and retrieve data from both table using something similar to this join
select * from employee_info i, employee_status s where s.emp_no = 102 and i.emp_no = s.emp_no ;


This join will fetch the record for employee 102 from both tables employee_info and employee_status. Hope it will help.


regards


Yasir

Re: query

Posted By:   Anonymous  
Posted On:   Friday, March 30, 2001 01:40 AM

can you please send me the details of the tables fields and please try to write your question clearly and keep some spaces like HTML TAGS so that I can understand your problem better..



or u send me a mail explaining your problem ..it seems your problem is very minute one...
About | Sitemap | Contact