p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: Exception Occurred


Message #1 by "Marce Murgoitio" <marcella01@h...> on Fri, 01 Mar 2002 07:19:59 -0800
<html><div style='background-color:'><DIV>
<P>Hi,</P>
<P>Hi,<BR>&gt; <BR>&gt; I keep getting this error and I can't figure out what the problem is.&nbsp;
I<BR>join two tables, category and job opening and I am trying to display the<BR>category with each job opening under
the appropriate category.&nbsp; Here is my<BR>code.&nbsp; Any suggestions!! Thanks&nbsp; </P>
<P>PS I am using SQL Server<BR>&nbsp;&lt;%<BR>&nbsp;Set rst =
Server.CreateObject("ADODB.Recordset")<BR>&nbsp;sqlstring = "SELECT DISTINCT
tbl_category.CategoryName,<BR>tbl_category.CategoryID, tbl_jobopenings.JobID,
tbl_jobopenings.JobTitle,<BR>tbl_jobopenings.StartDate, tbl_jobopenings.EndDate FROM tbl_category LEFT<BR>JOIN
tbl_jobopenings ON tbl_category.CategoryName =<BR>tbl_jobopenings.CategoryName"<BR>&nbsp;rst.Open sqlstring, Cnn, 0,
1<BR>&nbsp;%&gt;<BR><BR>&nbsp;&lt;%&nbsp;<BR>&nbsp;&nbsp; If rst.EOF
Then&nbsp;<BR>&nbsp;&nbsp; %&gt;<BR>&nbsp;&nbsp; &lt;TR&gt;&lt;TD&gt;Sorry,
there are no Job Categories.&lt;/TD&gt;&lt;/TR&gt;<BR>&nbsp; &lt;%<BR>&nbsp;
Else<BR>&nbsp;&nbsp;&nbsp; rst.movefirst
%&gt;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp; &lt;%&nbsp; while NOT rst.EOF
%&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;% MyPosition= rst.fields("CategoryName")
%&gt;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;
&lt;TR&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;TD bgcolor="#ccccff" width="50%"
class="body"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;
&lt;a<BR>href="edit_category.asp?mode=edit&amp;categoryid=&lt;%=rst.Fields("CategoryID")%&gt;"&gt;<BR&g
t;&lt;%=rst.Fields("CategoryName")%&gt;&lt;/a&gt;&lt;/b&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;</P>
<P>&lt;TD align=right&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>
<P>&lt;a<BR>href="edit_category.asp?mode=edit&amp;categoryid=&lt;%=rst.Fields("CategoryID")%&gt;"&gt
;<BR>Edit&lt;/a&gt;&amp;nbsp;&amp;nbsp;<BR>&nbsp;&nbsp;
&lt;a<BR>href="edit_category.asp?mode=view&amp;categoryid=&lt;%=rst.Fields("CategoryID")%&gt;"&gt;<BR&g
t;View Full&lt;/a&gt;&amp;nbsp;&amp;nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;a<BR>href="edit_category.asp?mode=delete&amp;categoryid=&lt;%=rst.Fields("CategoryID")%&gt;<BR>&
amp;"&gt;Delete&lt;/a&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/TD&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/TD&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;
&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR&g
t;&nbsp;&nbsp;&nbsp; &lt;% do while MyPosition =
rst.fields("CategoryName")%&gt;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp; &lt;TD bgcolor="#ffcccc" width="50%" class="body"
"align=center"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a<BR>href="edit_jobo
penings.asp?mode=edit&amp;jobid=&lt;%=rst.Fields("JobID")%&gt;"&gt;&lt;%=rst.<BR>Fields("JobTitle")%&g
t;&lt;/a&gt;&lt;/b&gt;&lt;br&gt;<BR><BR>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;&lt;%=rst.Fields("StartDate")%&gt;<BR>&amp;nbsp;
&lt;%=rst.Fields("EndDate")%&gt;&lt;/b&gt;&lt;br&gt;&lt;br&gt;<BR>&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp; &lt;TD align=right&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;a<BR>href="edit_jobopenings.asp?mode=edit&amp;jobid=&lt;%=rst.Fields("JobID")%&gt;"&gt;Edit&lt;/a&
lt;BR>&amp;nbsp;&amp;nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;a<BR>href="edit_jobopenings.asp?mode=view&amp;jobid=&lt;%=rst.Fields("JobID")%&gt;"&gt;View<BR>F
ull&lt;/a&gt;&amp;nbsp;&amp;nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;a<BR>href="edit_jobopenings.asp?mode=delete&amp;jobid=&lt;%=rst.Fields("JobID")%&gt;&amp;"&gt;Dele
<BR>te&lt;/a&gt;&amp;nbsp;&amp;nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/TD&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/TD&gt;<BR>&nbsp;&nbsp;&nbsp;
&lt;/TR&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;<
;BR>&nbsp;&nbsp;&nbsp; &lt;%rst.movenext<BR>&nbsp;&nbsp;&nbsp;
loop%&gt;<BR>&nbsp;&nbsp;&nbsp;
&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;<BR>&nbsp;&nbsp;&nbsp;&
;nbsp;<BR>&nbsp;&nbsp;&nbsp; &lt;% wend
%&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp; &lt;% end
if%&gt;<BR>&nbsp; &lt;TR&gt;&lt;td
class="body"&gt;&amp;nbsp;&lt;br&gt;&lt;br&gt;&lt;a
href="admin.asp"&gt;Admin<BR>Home&lt;/a&gt;&lt;br&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&
lt;BR>&nbsp; &lt;/table&gt;<BR>&nbsp;&lt;%<BR>&nbsp; rst.close<BR>&nbsp; set rst =
nothing<BR>&nbsp; Cnn.close<BR>&nbsp; set
Cnn=nothing<BR>&nbsp;%&gt;<BR>&nbsp;&lt;!--#include
file="footer.asp"--&gt;<BR>&nbsp;<BR>&nbsp;<BR>
<BR><BR><BR></P></DIV></div><br clear=all><hr>Join the world?s largest e-mail
service with MSN Hotmail. <a href='http://g.msn.com/1HM105401/16'>Click Here</a><br></html>

  Return to Index