Vb runtime Error on Null

0uT0f0rDeR

New Member
My following code is throwing an error of an invalid use of Null. I'm just learning SQL & VBscript so any help would be hugely appreciated.I've crated a table in SQL where I want to dynamically create news articles via the admin centre.The error message is: "Microsoft VBScript runtime error '800a005e'Invalid use of Null: 'CInt'/Admin/FranchiseAdmin/News/Default.asp, line 71"The line it's referring to is: \[code\]<% getrs tmp,"SELECT COUNT(*) FROM CommunityNewsComments WHERE nc_article = "&cint(rs("cn_id")),"" %>\[/code\]And the code for 'Default.asp' is:\[code\]<!--#include virtual="/System/Startup_Admin.asp"--><!--#include virtual="/Admin/FranchiseAdmin/ContentEditor/i_EditContent.asp"--><%if len(""&request.querystring("delarticle"))>0 then getrs rs,"SELECT * FROM CommunityNews WHERE cn_franchise = '"&session("AdminFranchiseGID")&"' AND cn_id = '"&cint(request.querystring("delarticle"))&"';","" if rs.recordcount > 0 then path = server.MapPath("/LiveStorage/Uploads/image/CommunityNews/")&"\" set fs = server.CreateObject("scripting.filesystemobject") if len(""&rs("cn_thumbnail"))>0 then if fs.fileexists(path&rs("cn_thumbnail")) then fs.deletefile(path&rs("cn_thumbnail")) end if if len(""&rs("cn_fullimage"))>0 then if fs.fileexists(path&rs("cn_fullimage")) then fs.deletefile(path&rs("cn_fullimage")) end if exesql "DELETE FROM CommunityNews WHERE cn_franchise = '"&session("AdminFranchiseGID")&"' AND cn_id = '"&cint(request.querystring("delarticle"))&"';","" end if response.redirect "Default.asp"end if%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Inside-Guides.co.uk - Community News Administration</title><!--#include virtual="/Assets/Templates/Admin/FranchiseAdmin/HeadCSS.asp"--></head><body><!--#include virtual="/Assets/Templates/Admin/FranchiseAdmin/TemplateStart.asp"--><br /><h1>Community News: <%Response.Write(Session("AdminFranchiseName"))%> Franchise Admin</h1><br /><br /><br /><%If Not Session("Role_Franchise_ManageContent") then AccessDeniedgetrs rs,"SELECT * FROM CommunityNews WHERE cn_franchise = '" & Session("AdminFranchiseGID") & "' ORDER BY cn_live ASC,cn_startdate DESC",""if rs.RecordCount = 0 then %> <p>&nbsp;</p> <p>There are no articles to display</p> <p>&nbsp;</p> <% Else %> <table class="DataList"> <tr class="DataListHeader" style="height:40px;"> <th align="left" valign="middle"> Article Title </th> <th align="center" valign="middle"> Start/End Date </th> <th align="center" valign="middle"> Comments </th> <th align="center" valign="middle"> Live? </th> <th align="center" valign="middle"> Action </th> </tr> <% While Not rs.EOF %> <tr> <td align="left" valign="middle" style="height:40px;border-bottom:1px dotted #ddd;">&nbsp; <%=server.HTMLEncode(""&rs("cn_title"))%> </td> <td align="center" valign="middle" style="height:40px;border-bottom:1px dotted #ddd;">&nbsp; <%=server.HTMLEncode(""&rs("cn_startdate"))%> / <%=server.HTMLEncode(""&rs("cn_enddate"))%> </td> <td align="center" valign="middle" style="height:40px;border-bottom:1px dotted #ddd;">&nbsp; <a href="http://stackoverflow.com/questions/11809381/EditComments.asp?a=<%=server.URLEncode(""&rs("cn_id"))%>"> <% getrs tmp,"SELECT COUNT(*) FROM CommunityNewsComments WHERE nc_article = "&cint(rs("cn_id")),"" %> <%=tmp(0)%> <% getrs tmp,"SELECT COUNT(*) FROM CommunityNewsComments WHERE nc_article = "&cint(rs("cn_id"))&" AND nc_approved = 0;","" if cint(tmp(0))>0 then %> <strong>New Comments!</strong> <% end if %> </a> </td> <td align="center" valign="middle" style="height:40px;border-bottom:1px dotted #ddd;"> <% if ""&rs("cn_live") = "True" then %> <img src="http://stackoverflow.com/Assets/Images/Icons/Tick.gif" width="15" /> <% else %> <img src="http://stackoverflow.com/Assets/Images/Icons/Cross.gif" width="15" /> <% end if %> </td> <td align="center" valign="middle" style="height:40px;border-bottom:1px dotted #ddd;">&nbsp; <a href="http://stackoverflow.com/questions/11809381/EditArticle.asp?a=<%=server.URLEncode(""&rs("cn_id"))%>"><% = GetIcon("Edit", "Edit Custom Content", 25, True) %></a> <a href="http://stackoverflow.com/questions/11809381/Default.asp?delarticle=<%=server.URLEncode(""&rs("cn_id"))%>" onclick="if (!confirm('Delete this article?')) {return false;}"><% = GetIcon("Delete", "Delete Custom Content", 25, True) %></a> </td> </tr> <% rs.MoveNext : Wend %> </table> <%end if%> <div id="legend" class="clearfix" style="width:60%"> <h3>Legend</h3><br /> <a href="http://stackoverflow.com/questions/11809381/AddNews.asp"><% = GetIcon("Add", "Create Custom Content", 25, True) %><span>Create News Item</span></a> <% = GetIcon("Edit", "Edit Custom Content", 25, True) %><span>Edit News Item</span> <% = GetIcon("Delete", "Delete Custom Content", 25, True) %><span>Delete News Item</span> </div><br /><!--#include virtual="/Assets/Templates/Admin/FranchiseAdmin/TemplateEnd.asp"--></body></html><!--#include virtual="/System/Shutdown.asp"-->\[/code\]It's pertaining to the dbo.CommunityNewsComments table, but not sure why or what I can do to fix it.Any help much appreciated.
 
Back
Top