Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 07:29 AM
the chad
Guest
 
Posts: n/a
Default I cannot get this inner join to work in asp

<!--#Include Virtual="/bug/adovbs.inc"-->

<title>Bug Status Board</title>

<%

Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog =
techsupportBT; User Id = sa; Password="
Set rs = server.CreateObject("ADODB.Recordset")

sSQL="SELECT T.BugIndex, T.[Date Entered], T.DESCRIPTION,"
sSQL= ssql &" T.Company, T.Technician, T.Developer, T.PROGRAM, "
sSQL= ssql &" T.Status, T.PRIORITY, T.[Version Fix], n.noc"
sSQL= ssql &"FROM TSHIGHISSUES INNER JOIN noc ON T.BugIndex =
n.bugindex "

set rs=conn.Execute(ssql)

and this is the error message that I get
Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
Incorrect syntax near the keyword 'INNER'

I cannot find an example anywhere that helps with this situation.
This works fine in SQL, but for some reason asp is being a pain.
  #2  
Old July 19th, 2005, 07:29 AM
Manohar Kamath [MVP]
Guest
 
Posts: n/a
Default Re: I cannot get this inner join to work in asp

You forgot to alias the tables:

FROM TSHIGHISSUES T INNER JOIN noc n ON



--
Manohar Kamath
Editor, .netBooks
www.dotnetbooks.com


"the chad" <cswartz@stromberg.com> wrote in message
news:d5957558.0308071609.4b467b63@posting.google.c om...[color=blue]
> <!--#Include Virtual="/bug/adovbs.inc"-->
>
> <title>Bug Status Board</title>
>
> <%
>
> Dim conn
> Set conn = Server.CreateObject("ADODB.Connection")
> conn.Open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog =
> techsupportBT; User Id = sa; Password="
> Set rs = server.CreateObject("ADODB.Recordset")
>
> sSQL="SELECT T.BugIndex, T.[Date Entered], T.DESCRIPTION,"
> sSQL= ssql &" T.Company, T.Technician, T.Developer, T.PROGRAM, "
> sSQL= ssql &" T.Status, T.PRIORITY, T.[Version Fix], n.noc"
> sSQL= ssql &"FROM TSHIGHISSUES INNER JOIN noc ON T.BugIndex =
> n.bugindex "
>
> set rs=conn.Execute(ssql)
>
> and this is the error message that I get
> Error Type:
> Microsoft OLE DB Provider for SQL Server (0x80040E14)
> Incorrect syntax near the keyword 'INNER'
>
> I cannot find an example anywhere that helps with this situation.
> This works fine in SQL, but for some reason asp is being a pain.[/color]


  #3  
Old July 19th, 2005, 07:30 AM
Pappas Mike
Guest
 
Posts: n/a
Default Re: I cannot get this inner join to work in asp

Try this
you should say
" from tableone inner join tabletwo on tableone.field=tabletwo.field;"

sSQL="SELECT [T].[BugIndex], [T].[Date Entered], [T].[DESCRIPTION],"
sSQL= ssql &" [T].[Company], [T].[Technician], [T].[Developer],
[T].[PROGRAM], "
sSQL= ssql &" [T].[Status], [T].[PRIORITY], [T].[Version Fix], [n].[noc]"
sSQL= ssql &" FROM [T] INNER JOIN [n] ON [T].[BugIndex] = [n].[bugindex];"


  #4  
Old July 19th, 2005, 07:32 AM
The Chad
Guest
 
Posts: n/a
Default Re: I cannot get this inner join to work in asp



Thank you very much for all of your help. But you know how when you
think you are done with a project, you think of seomthing else that
would be nice to add? Well I thought of one that I cannot figure out.

This web page returns a result into another page called noc,when you
select the bug# from the primary page.The noc page Then displays the
bug# with a description and the noc(number of calls). I would like to be
able to update the noc from the noc page. This is my page as it stands
right now.
<!--#Include Virtual="/bug/adovbs.inc"-->
<title>Number of Calls</title>
<%
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog =
techsupportBT; User Id = sa; Password="
Set rsNOC = server.CreateObject("ADODB.Recordset")
strBugIndex = trim(Request.QueryString("bindex"))
strSql = "Select n.bugindex, t.description, n.noc "
strSql = strSql & "from NOC n, tshighissues t "
strSql = strSql & "where n.BugIndex = " & strBugIndex & " "
strSql = strSql & "And t.BugIndex = n.BugIndex "
set rsNOC=conn.Execute(strSql)
%><body bgcolor="#E8E8EA"><div align="left">
<p>
<a href="bug2.asp">
<img border="0" src="hdr_logo.jpg" width="240" height="37"></a> </p>
<p align="left">
<u><font size="6"
color="#94B2C6"><b><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;
Bug Status
Board&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;
</i></b></font></u></p>
&nbsp;<Table bordercolorlight="#94B2C6" bordercolordark="#000080"
border="2" bordercolor="#F3F3F3" align="left" width="100%">
<tr>
<th height="28">Bug #</th>
<th height="28">Description</th>
<th height="28">NOC</th>

</tr>
<%
While not rsNOC.EOF
%>
<tr>
<td><%=rsNOC.fields(0)%></td>
<td><%=rsNOC.fields(1)%></td>
<td><%=rsNOC.fields(2)%></td>

</tr>
</div>

What do you think would be the best way to add an update script into
this page to be able to update the noc column?

<%
rsNOC.MoveNext()
Wend
%><Close recrordsets and connection></body></html>

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles