[thelist] Sigh. More ASP. This time, trouble reading a file

Joel Morris joelm at citycent.com
Thu Aug 7 21:21:08 CDT 2003


<SNIP>
> Here is another piece of asp code that should work, but doesn't.
>
> set rsActivity=Server.CreateObject("ADODB.RecordSet")
>  sql="SELECT activityId,  event, eventType,  " & _
>  " MemberFee, NonMemberFee, Description, " & _
>  " from activityTable "
>
> sql=sql & " where ActivityId= " & aActivityId & ";"
>
>
> Response.write    sql & "<br>"
> rsActivity.Open sql,dsn
>
> if rsActivity.recordcount<=0 then
>  response.write "<h2><font align=center  color='#55eeee'
> >Sorry no items
> were found</font></h2>"
>  rsActivity.close
>  set rsActivity=nothing
>  response.end
> end if
>
>
> response.write "<tr><th>Activity Id</th>"
> response.write "<td>" &
> rsActivity.Fields("ActivityId").value & "</td>"
> response.write "</tr>"
</SNIP>

Hello --

1. Remove the comma after the Description field, i.e. it should be:

  " MemberFee, NonMemberFee, Description " & _
  " from activityTable "

2. I've had problems occasionally with the .recordcount property.
Instead, try this:

   If rsActivity.BOF And rsActivity.EOF Then
	Response.Write "Nothing there!"
   Else
	response.write "<tr><th>Activity Id</th>"
	response.write "<td>" &
	rsActivity.Fields("ActivityId").value & "</td>"
	response.write "</tr>"
	etc. ...


Best, Joel Morris
-------------------------------
CityCenter Co.
Website Development & Marketing
http://www.citycent.com
mailto:joelm at citycent.com



More information about the thelist mailing list