.NETGURU
SQL Query multiple table join
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngdata' list.


Collins, Mike
-- Moved from [aspngfreeforall] to [aspngdata] by Michiel van Otegem <Click here to reveal e-mail address> --

Can someone tell me what is wrong with this in ASP.net? I keep getting an
error "Incorrect syntax near 'dc'." Note: all of the first Select statement
line is on one line, which is why I don't have any & _ in there.

"An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error
and where it originated in the code. "

strDot Net Guruers = "Select dc.matterNumber, m.ClientNumber, m.Description,
m.Contact, m.ContactPhone, m.BillingAtty, m.SupervisingAtty,
m.OriginatingAtty, m.AssistingAtty1, m.AssistingAtty2, m.ReceivedBy,
m.ReferredBy, m.DocketNum, m.Judge, m.Court, dc.courtDistrict, dc.TrialType,
dc.Allegations, dc.Days, dc.Result, dc.Appeal, dc.Style"
        strDot Net Guruers &= "FROM DataCollection dc INNER JOIN Dot Net Guruer m
ON m.matterNumber = dc.matterNumber"
        strDot Net Guruers &= "WHERE (m.SupervisingAtty = '" & strUsername
& "'"
        strDot Net Guruers &= "OR     m.BillingAtty = '" & strUsername &
"'"
        strDot Net Guruers &= "OR     m.AssistingAtty1 = '" & strUsername
& "'"
        strDot Net Guruers &= "OR        m.AssistingAtty2 = )"

-Mike Collins

***********************************************************************
NOTICE: This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by telephone (404-881-7000) or by electronic mail (Click here to reveal e-mail address), and delete this message and all copies and backups thereof. Thank you.
=======================================================

Reply to this message...
 
    
Mark Bruce
put spaces before FROM, WHERE, and OR
"Collins, Mike" wrote:-- Moved from [aspngfreeforall] to [aspngdata] by Michiel van Otegem --

Can someone tell me what is wrong with this in ASP.net? I keep getting an
error "Incorrect syntax near 'dc'." Note: all of the first Select statement
line is on one line, which is why I don't have any & _ in there.

"An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the error
and where it originated in the code. "

strDot Net Guruers = "Select dc.matterNumber, m.ClientNumber, m.Description,
m.Contact, m.ContactPhone, m.BillingAtty, m.SupervisingAtty,
m.OriginatingAtty, m.AssistingAtty1, m.AssistingAtty2, m.ReceivedBy,
m.ReferredBy, m.DocketNum, m.Judge, m.Court, dc.courtDistrict, dc.TrialType,
dc.Allegations, dc.Days, dc.Result, dc.Appeal, dc.Style"
strDot Net Guruers &= "FROM DataCollection dc INNER JOIN Dot Net Guruer m
ON m.matterNumber = dc.matterNumber"
strDot Net Guruers &= "WHERE (m.SupervisingAtty = '" & strUsername
& "'"
strDot Net Guruers &= "OR m.BillingAtty = '" & strUsername &
"'"
strDot Net Guruers &= "OR m.AssistingAtty1 = '" & strUsername
& "'"
strDot Net Guruers &= "OR m.AssistingAtty2 = )"

-Mike Collins

***********************************************************************
NOTICE: This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by telephone (404-881-7000) or by electronic mail (Click here to reveal e-mail address), and delete this message and all copies and backups thereof. Thank you.
======================================================

| [aspngdata] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngdata.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

---------------------------------
Do You Yahoo!?
New! SBC Yahoo! Dial - 1st Month Free & unlimited access
Reply to this message...
 
    
Dan Wahlin
Try adding a space in front of the FROM, WHERE, and OR keywords as
everything is getting squished together. The easiest way to see exactly
what is going on is to do a Trace.Write() (or the old Response.Write())
on your strDot Net Guruers string so you can see exactly what query is being
executed.

HTH,
Dan Wahlin

Wahlin Consulting LLC
Microsoft MVP - ASP.NET
http://www.XMLforASP.Net: #1 ASP.NET XML Resource
XML for ASP.NET Developers by Dan Wahlin in bookstores everywhere!

-----Original Message-----
From: Collins, Mike [mailto:Click here to reveal e-mail address]
Sent: Tuesday, July 09, 2002 1:22 PM
To: aspngdata
Subject: [aspngdata] SQL Query multiple table join

-- Moved from [aspngfreeforall] to [aspngdata] by Michiel van Otegem
<Click here to reveal e-mail address> --

Can someone tell me what is wrong with this in ASP.net? I keep getting
an
error "Incorrect syntax near 'dc'." Note: all of the first Select
statement
line is on one line, which is why I don't have any & _ in there.

"An unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error
and where it originated in the code. "

strDot Net Guruers = "Select dc.matterNumber, m.ClientNumber, m.Description,
m.Contact, m.ContactPhone, m.BillingAtty, m.SupervisingAtty,
m.OriginatingAtty, m.AssistingAtty1, m.AssistingAtty2, m.ReceivedBy,
m.ReferredBy, m.DocketNum, m.Judge, m.Court, dc.courtDistrict,
dc.TrialType,
dc.Allegations, dc.Days, dc.Result, dc.Appeal, dc.Style"
        strDot Net Guruers &= "FROM DataCollection dc INNER JOIN
Dot Net Guruer m
ON m.matterNumber = dc.matterNumber"
        strDot Net Guruers &= "WHERE (m.SupervisingAtty = '" &
strUsername
& "'"
        strDot Net Guruers &= "OR     m.BillingAtty = '" & strUsername
&
"'"
        strDot Net Guruers &= "OR     m.AssistingAtty1 = '" &
strUsername
& "'"
        strDot Net Guruers &= "OR        m.AssistingAtty2 = )"

-Mike Collins

***********************************************************************
NOTICE: This e-mail message and all attachments transmitted with it may
contain legally privileged and confidential information intended solely
for the use of the addressee. If the reader of this message is not the
intended recipient, you are hereby notified that any reading,
dissemination, distribution, copying, or other use of this message or
its attachments is strictly prohibited. If you have received this
message in error, please notify the sender immediately by telephone
(404-881-7000) or by electronic mail (Click here to reveal e-mail address), and delete
this message and all copies and backups thereof. Thank you.
=======================================================

| [aspngdata] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngdata.asp = JOIN/QUIT
| http://www.asplists.com/search = SEARCH Archives

Reply to this message...
 
 
System.Diagnostics.Trace




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification