| |
ruaand
Posts: 1
Score: 0
Joined: 11/1/2006
Status: offline
|
Hallo, I have a asp page that connects to a SQL database and displays disk space reports on multiple sql servers but for some reason I cannot get the asp page to connect to the database. Can anyone please help me with the code that I have attached below? Thanks, Ruaan <!-- #include file="adovbs.inc" --> <HTML> <H1>Disk Monitor</H1> <% Session.Timeout = 480 set connection=server.createObject("ADODB.Connection") connection.OPEN "SERVER=sql2k\instance1;DATABASE=DiskMonitor;UID=DiskUser;PWD=Disk;DRIVER={SQL Server};" set rs = server.createobject("ADODB.Recordset") rs.cursortype = adopenstatic query = "select Computer,Drive,DiskSize,FreeSpace,Percentage,date,Color=case when percentage<16 then 'R' when percentage>16 and percentage<21 then 'Y' when percentage>20 then 'G' end from FreeSpace order by computer,Drive" rs.open query,connection %> <TABLE border=1 bordercolor= rgb(114,150,145) cellPadding=1 cellSpacing=0 width="75%" align=center> <TD></TD> <TR> <TD bgColor=white><B><font color = "black" face="VERDANA" STYLE="font-size:10px"> Server</B></TD> <TD bgColor=white><B><font color = "black" face="VERDANA" STYLE="font-size:10px"> Drive</B></TD> <TD bgColor=white><B><font color = "black" face="VERDANA" STYLE="font-size:10px"> Disk Space (MB)</B></TD> <TD bgColor=white><B><font color = "black" face="VERDANA" STYLE="font-size:10px"> FreeSpace (MB)</B></TD> <TD bgColor=white><B><font color = "black" face="VERDANA" STYLE="font-size:10px"> Percentage Free</B></TD> <TD bgColor=white><B><font color = "black" face="VERDANA" STYLE="font-size:10px"> TimeStamp</B></TD> <!--rgb(61,32,87) --> <TR><TD></td></tr> <%do while not rs.eof%> <TR> <TD bgColor=CCCCCC><font color = "black" face="VERDANA" STYLE="font-size:10px" > <%=rs("Computer")%></B></TD> <TD bgColor=white><font color = "black" face="VERDANA" STYLE="font-size:10px" > <%=rs("Drive")%></B></TD> <TD bgColor=white><font color = "black" face="VERDANA" STYLE="font-size:10px" > <%=rs("DiskSize")%></B></TD> <TD bgColor=white><font color = "black" face="VERDANA" STYLE="font-size:10px" > <%=rs("FreeSpace")%></B></TD> <% if rs("Color") ="R" then %> <TD bgColor=red><font color = "black" face="VERDANA" STYLE="font-size:10px" > <% end if %> <% if rs("Color") ="Y" then %> <TD bgColor=yellow><font color = "black" face="VERDANA" STYLE="font-size:10px" > <% end if %> <% if rs("Color") ="G" then %> <TD bgColor=blue<font color = "black" face="VERDANA" STYLE="font-size:10px" > <% end if %><%=rs("Percentage")%></B></TD> <TD bgColor=white><font color = "black" face="VERDANA" STYLE="font-size:10px" > <%=rs("Date")%></B></TD> <%rs.movenext%> </TR> <%loop%> </table>
|
|