asp.net - Trying to get an ASP report to run a SQL against 2 tables -
i know older way of doing things, have stick have @ time. trying asp report go against 2 different sql tables , can't seem right.
below section of working on. work great getting error 500. yes run on server , yes have turned off friendly error messages.
<%@ language = "vbscript" %> <html> <head> <meta http-equiv="content-type" content="text/html;charset=windows-1252"> <title>auto aid events</title> <script type="text/javascript"> </script> </head> <body> <% 'these next 3 lines response.cachecontrol = "no-cache" response.addheader "pragma", "no-cache" response.expires = 0 'sqloledb connection...(used timeout config can set) dim myconn set myconn = server.createobject("adodb.connection") myconn.commandtimeout = 0 'unlimited timeout period myconn.open "provider=sqloledb; data source=server; initial catalog=data1; enter code here`enter code here`user id=user; password=password" set rs=server.createobject("adodb.recordset") sql = " select dgroup, cdts, sub_tycod, num_1, prim_unit, xterm agency_event dgroup = 'fire' , sub_tycod = 'autoaid' , cdts > '20150501%' , " sql = sql +" xterm <> '150003l' order num_1 " 'response.write (sql) rs.open sql, myconn if rs.eof response.write "--no events found--" 'response.end end if 'rs.movefirst %> <table border=4 bgcolor=#ffffff cellspacing=0><font face="arial" color=#000000><caption><b>event agency</b></caption></font> <thead> <tr> <th bgcolor=#c0c0c0 bordercolor=#000000 ><font style="font-size: 10pt" face="arial" color=#000000 > agency </font></th> <th bgcolor=#c0c0c0 bordercolor=#000000 ><font style="font-size: 10pt" face="arial" color=#000000 > event </font></th> <th bgcolor=#c0c0c0 bordercolor=#000000 ><font style="font-size: 10pt" face="arial" color=#000000 > fire case number </font></th> <th bgcolor=#c0c0c0 bordercolor=#000000 ><font style="font-size: 10pt" face="arial" color=#000000 > primary unit </font></th> <th bgcolor=#c0c0c0 bordercolor=#000000 ><font style="font-size: 10pt" face="arial" color=#000000 >sub event description </font></th> </tr> </thead> <tbody> <% until rs.eof %> <tr valign=top> <!--first column --> <%if not isnull(rs.fields("dgroup")) then%> <td bordercolor=#c0c0c0 > <font style="font-size: 10pt" face="arial" color=#000000> <%=server.htmlencode(rs.fields("dgroup").value)%></font> <%else%> <td bordercolor=#c0c0c0 > <font style="font-size: 10pt" face="arial" color=#c0c0c0> <%=server.htmlencode("<null>")%></font> <%end if%> </td>
this not valid sql syntax:
cdts > '20150501%' a more correct way this:
the info in field looks 20150506150322ed. looking information starts on date , nothing prior it
would this:
cast(left(cdts, 8) date) > '20150501'
Comments
Post a Comment