Wrox Programmer Forums
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 8th, 2005, 01:16 PM
Authorized User
 
Join Date: Jan 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default JOIN STATEMENT

Can someone tell me what is wrong with my sql statement? My program works if I do not use the JOIN statement. Help............please.

myDataAdapter.SelectCommand.CommandText = & _
"SELECT ReceivedDrug, DispensedDrug " & _
"FROM Received " & _
"JOIN Dispensed ON Received.ReceivedDrug = Dispensed.DispensedDrug "
 
Old February 9th, 2005, 10:02 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

what's your database??? maybe it want you to writte INNER JOIN???



HTH

Gonzalo
 
Old February 9th, 2005, 12:48 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Try:
Code:
    myDataAdapter.SelectCommand.CommandText = & _
        "SELECT ReceivedDrug, DispensedDrug " & _
        "FROM   Received, Dispensed         " & _
        "WHERE  Received.ReceivedDrug = Dispensed.DispensedDrug"
 
Old February 9th, 2005, 05:34 PM
Authorized User
 
Join Date: Jan 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you both. I finally got it to work.
 
Old February 10th, 2005, 12:10 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

How?
 
Old February 10th, 2005, 04:18 PM
Authorized User
 
Join Date: Jan 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

myDataAdapter.SelectCommand.CommandText = "SELECT ReceivedDrug, Received.ScannedDate " & _
        "FROM Dispensed RIGHT JOIN (Received LEFT JOIN Destroyed ON Received.ReceivedDrug = Destroyed.Destroyed) ON Dispensed.DispensedDrug = Received.ReceivedDrug " & _
        "WHERE ((Dispensed.DispensedDrug) Is Null) AND ((Destroyed.Destroyed) Is Null) "


Brian - I think you helped me out a couple of times. Thanks so much.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't figure out an OUTER JOIN statement dhsmd SQL Language 5 September 18th, 2008 01:02 AM
SQL statement that includes LEFT & RIGHT JOIN in callagga SQL Language 13 June 9th, 2008 02:30 AM
Trouble with simple JOIN statement zoltac007 SQL Server ASP 1 May 31st, 2007 10:09 AM
please verify my INNER JOIN statement gilgalbiblewheel Classic ASP Databases 6 April 5th, 2005 07:38 AM
Oracle 8i inner join and left join problem puteri_84 Oracle 2 August 19th, 2004 07:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.