Hi all, It's me again

! I need to get Title,Arthur,Publisher(BOOK Table) and Price(Inventory) where ID(PK of Book) = INVENT_ID(FK at inventory) AND ID=1 .I tried following code and it's not working ...
cmd = New OleDbCommand("select Title,Arthur,Publisher,Price from Book,Inventory where ID=INVENT_ID AND ID=1", cn)
--> Thread moved to SQL Development
What happens when you run that SQL? Any errors or just no output? I see you're trying to gather data from two tables. Have you considered using a JOIN?
Was this answer helpful ?
Yes No
wow I got it already now ..thanks alot for giving me idea about that JOIN thing ...It's hard when hardware guy join Uni and attending programming class ...I m totally noob at programming ...
Was this answer helpful ?
Yes No
Quote:
| Originally Posted by jmurrayhead --> Thread moved to SQL Development
What happens when you run that SQL? Any errors or just no output? I see you're trying to gather data from two tables. Have you considered using a JOIN? |
I don't see anything wrong with the query off-hand. It's equivalent to doing an INNER JOIN, at least in Oracle (tho, I dislike that syntax personally).
Can you define 'not working' a little better>
Was this answer helpful ?
Yes No
Cheers, glad you got it working
Could you post your working solution so others may learn from it?
Thanks
Was this answer helpful ?
Yes No
Sure , I don't use the JOIN funtion but i did go n read and will use in future but for the time being ..this following code works ..
cmd = New OleDbCommand("select Title,Arthur,Publisher,Price,Quantity from Book,Inventory where ID=Invent_ID AND ID=1 order by ID", cn)
Was this answer helpful ?
Yes No
Quote:
| Originally Posted by piscarian Sure , I don't use the JOIN funtion but i did go n read and will use in future but for the time being ..this following code works ..
cmd = New OleDbCommand("select Title,Arthur,Publisher,Price,Quantity from Book,Inventory where ID=Invent_ID AND ID=1 order by ID", cn) |
Ah, so it would appear that in your db world, case matters on column names? Not so in my Oracle world, which is why I didn't think of it. I'll store that in my back brain for future reference.
Was this answer helpful ?
Yes No