I have an ASP page called map.asp and in it I have a dynamically generated table with links to detailed node and utilization information. However, I need to pass this information to a frameset. It currently is code like this:
<a href='gauge-frame.asp?nodeid=<%response.write rsnetdevices("nodeid")%>'
where gauge-frame.asp looks like this:
<frame src="details.asp?nodeid=<%response.write rsnetdevices("nodeid")%>">
However, I'm getting a "Page cannot be displayed error".
Suggestions on how to fix are appreciated.
Dale
============================
Below is maptest.asp
<%
Option Explicit
Dim rsSolarWinds, conn, rsnetdevices, nodeid
nodeid = Request.QueryString("nodeid")
set Conn=Server.CreateObject("ADODB.Connection")
set rsSolarWinds = server.CreateObject("ADODB.Recordset")
Conn.open "Provider=sqloledb;Server="";Initial Catalog=Skynet;
set rsnetdevices = conn.Execute ("SELECT Caption AS NodeName, nodeid, category, substring(statusdescription, 16,4) as nodedown " _
& " from nodes " _
& " where category = 'Infrastructure' or caption like '%intswt%' or caption like '%intrtr%') " )
<!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">
<table class="gradienttable" cellspacing="0" border>
<tr>
<th colspan=4 style="font-size:7.5pt"; "font:small Verdana,Sans-serif";"font-family:Verdana" align="center">Network Devices</th>
</tr>
<tr>
<th style="font-size:7.5pt"; "font:small Verdana,Sans-serif";"font-family:Verdana" align="center">Node ID</th>
<th style="font-size:7.5pt"; "font:small Verdana,Sans-serif";"font-family:Verdana" align="center">Node Name</th>
<th style="font-size:7.5pt"; "font:small Verdana,Sans-serif";"font-family:Verdana" align="center">Node Status</th>
</tr>
<%do while not rsnetdevices.EOF%></do>
<tr>
<td width=8 style="font-size:7.5pt"; "font:small Verdana,Sans-serif";"font-family:Verdana" align="center">
<a href='gauge-frame.asp?nodeid=<%response.write rsnetdevices("nodeid")%>' target="_blank" title="Show Node Details")><%response.write rsnetdevices("nodeid")%></a>
</td>
<%rsnetdevices.MoveNext%>
<%loop%>
</tr>
</table>
</body>
</html>
And below is frame-gauge.asp
<%
Option Explicit
Dim rsnetdevices, conn, nodeid
nodeid = Request.QueryString("nodeid")
set Conn=Server.CreateObject("ADODB.Connection")
set rsnetdevices = server.CreateObject("ADODB.Recordset")
Conn.open "Provider=sqloledb;Server="";Initial Catalog=Skynet;"
set rsnetdevices = conn.Execute ("SELECT description, sysname, machinetype, type, devicerole, cpuload, substring(statusdescription, 16,4) as nodedown, substring(statusdescription, 16,2) as nodeup, " _
& " ip_address, dns, nextpoll, location, unmanaged, percentmemoryused, contact, lastboot, iosversion, cpucount, substring(description, 77, 53) as software " _
& " FROM Nodes " _
& " where Nodes.Nodeid = '" &nodeid & "' " )
%>
<html>
<head>
<Title>Network Device Information</title>
<frameset cols="48%,52%" frameborder="0">
<frame src="gauges.asp" scrolling="NO" marginheight=0 marginwidth=0 >
<frame src="details.asp?nodeid=<%response.write rsnetdevices("nodeid")%>">
</frameset>
</head>
</html>
#SearchAndResQ was correct in that nodeid was missing in the select statement.
I see an extra closing parenthesis at the end of the SQL in this section:
set rsnetdevices = conn.Execute ("SELECT Caption AS NodeName, nodeid, category, substring(statusdescription, 16,4) as nodedown " _
& " from nodes " _
& " where category = 'Infrastructure' or caption like '%intswt%' or caption like '%intrtr%') " )
As ullfindsmit commented, you need to disable the "Show Friendly Messages" misfeature in IIS, so it'll give you the actual line number and error message, not the totally useless and infuriating "page couldn't be displayed" message.
Related
I have an HTA application I would like to run from a Command Prompt.
I've tried everything I could possibly think of and it's just not working!
It just launches the application and that's it.
From Command Prompt I run it with the full path as such:
C:\users\xxx\script.hta "arg1" "arg2"
which is essentially what I'm trying to accomplish here?
I've gone through numerous pages on here with similar issues but I guess I'm just not putting it together properly!
Here is the code:
<html>
<head>
<HTA:Application
ID="oHTA"
APPLICATIONNAME="MSI-BUILD"
Border = "NO"
Singleinstance ="YES"
BorderStyle = "Complex"
ShowInTaskBar = "YES"
MaximizeButton = "No"
MinimizeButton = "No"
scroll="NO"
VERSION="2"
/>
<script language = "VBScript">
Sub RunProgram
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set objShell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
strCurDir= WshShell.CurrentDirectory
StrARG = MSINAME.value
StrARG3 = FPath.value
strFolder = "D:\SMPSS\PROJECTS\"&MSINAME.value
Set oFSO = CreateObject("Scripting.FileSystemObject")
If Not oFSO.FolderExists(strFolder) Then
oFSO.CreateFolder strFolder
End If
objShell.Run "D:\SMPSS\MSI-2\1-newproject.vbs " & StrARG , 0, True
window.close()
End Sub
Sub Window_onLoad
Self.Resizeto 890, 300
document.title = oHTA.applicationName & " v" & oHTA.version
arrCommands = Split(oHTA.commandLine, chr(34))
For i = 3 to (Ubound(arrCommands) - 1) Step 2
Select Case arrCommands(i)
Case "arg1"
myarg1 = "This is argument 1."
Case "arg2"
myarg2 = "This is argument 2."
End Select
Next
MsgBox myarg1
MsgBox myarg2
End Sub
</script>
</head>
<body style="background-color: #b2b2f4">
<td>MSI-NAME:</td>
<td> </td>
<td style="overflow:hidden">
<td style="resize:none">
<td style="text-align:right">
<td style="width: 325px"><input type = "text" name = "MSINAME" id = "MSINAME" size="50" /></td>
<p>
<td>PATH:</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td style="overflow:hidden"></td>
<td style="resize:none"></td>
<td style="text-align:right"></td>
<td style="width: 325px"><input type = "text" name = "FPath" id = "FPath" value ="" size="50" /></td>
<td> </td>
</p>
<p>
<input id='submit' type="button" value="Submit" onClick="RunProgram"></td>
</p>
</body>
</html>
I figured it out the issue was having <meta http-equiv="x-ua-compatible" content="ie=9"> in my code once removed everything started working as it should thanks! Also the file wasn't saved as ANSI so it was having invalid character errors. Everything is working great now!
I am receiving this error after login: Microsoft VBScript runtime error '800a004c' Path not found /ppi/files.asp, line 23.
How do I fix error? See below:
SQL = "SELECT * FROM [rapid_prod].[dbo].[PPI] WHERE [UserName] ='" & Request.Form("txtUserName") & "'"
rs.Open SQL, Conn
If NOT rs.EOF Then
If (Request.Form("txtUserPass")) = rs("Passwd") Then
Session("TopUrl") = rs("PPI_Dir")
Dim propertyname, propertydir
propertyname = rs("Property_Name")
propertydir = rs("PPI_Dir")
rs.Close
Set rs = Nothing
Conn.Close
Set Conn = Nothing
Response.Redirect "/ppi/files.asp?property="& propertyname &"&fold="& propertydir
End If
End If
In relation to the above code, I am adding the file for the redirect. Here is the file.asp code below:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%
If Request.QueryString("fold")= "" then
'pthFolder="/ppi/"
Response.Write("<center><br><br><br>There was either an error with your request<br> Or Your session timed out.<br><br><a href='../ppi.asp'>Return to the login page.</a></center>")
Else
'pthFolder=pthFolder&"/ppi/"&Request.QueryString("fold")
'pthFolder="/ppi/"&Request.QueryString("fold")
sTopUrl = "files.asp?fold="&Session("TopUrl")
pthFolder= Request.QueryString("fold")
Set fso=Server.CreateObject("Scripting.FileSystemObject")
'get all required info
sParentFolder=fso.GetParentFolderName(pthFolder)
If sParentFolder="" then sParentFolder="/"
If left(sParentFolder,1)="/" or left(sParentFolder,1)="\" then sParentFolder=Mid(sParentFolder,2)
sBackURL="files.asp?fold="&sParentFolder
dim FolderSize
FolderSize=0
Set Folder=fso.GetFolder(Server.MapPath(pthFolder))
'correct the pthFolder variable if it starts with a slash
'we will not be using the mappath method anymore, so we can discard the slash
If left(pthFolder,1)="/" or left(pthFolder,1)="\" then pthFolder=Mid(pthFolder,2)
'now, if the folder name does not end with a slash, then add a slash
If len(pthFolder)>0 and right(pthFolder,1)<>"/" and right(pthFolder,1)<>"\" then _
pthFolder=pthFolder&"/"
%>
<HTML>
<HEAD>
<title>PPI</title>
<link href="ppi.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="./fancybox/jquery.mousewheel-3.0.2.pack.js"></script>
<script type="text/javascript" src="./fancybox/jquery.fancybox-1.3.1.js"></script>
<link rel="stylesheet" type="text/css" href="./fancybox/jquery.fancybox-1.3.1.css" media="screen" />
<link rel="stylesheet" href="style.css" />
<script type="text/javascript">
$(document).ready(function() {
$("a#example5").fancybox({
'titlePosition' : 'inside'
});
});
</script>
<script>
function newWindow(urlname)
{
var a=window.open(urlname,'winName',"top=100, left=100, width=680, height=520, scrollbars=no");
a.focus();
}
</script>
</HEAD>
<BODY>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" style="padding-bottom:20px;"><img src="img/banner.gif" width="760" height="133"></td>
</tr>
<tr>
<td valign="top">
<br><br>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="568"><span class="body1">Viewing for: <b><a href="<% =sTopURL %>&property=<% = Request.QueryString("property") %>">
<% = Request.QueryString("property") %>
</a> /
<% If Request.Querystring ("subprop") <> "" then %>
<% If Request.Querystring ("level") = "eof" then %>
<a href="<% =sBackURL %>&property=<% = Request.QueryString("property") %>&subprop=<% = Request.QueryString("subprop") %>">
<% = Request.QueryString("subprop") %>
</a>
<% Else %>
<% = Request.QueryString("subprop") %>
<% End If %>
<% End If %>
</b></span> </td>
<td width="82" align="right">Logout</td>
</tr>
</table>
<br>
<% If Request.Querystring ("level") = "eof" then %>
<br>
<table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="347" class="body1">Vehicles for <b><% = Request.QueryString("month") %></b></td>
<td width="168" align="right"> </td>
</tr>
<tr>
<td colspan="2"><span class="smallprint">Click on thumbnail for larger view</span> <br>
<hr> </td>
</tr>
</table>
<%
' ---------------- START FILE VIEW -------------------------------
Dim ImagePath
ImagePath = Request.QueryString("fold")
Response.write "<table width=""680"" align=""center"" border=""0"">"
'iColumnSpan is used as a column counter
iColumnSpan=0
response.write "<tr>"
'If there are records then loop through the fields AND iColumnSpan <= IntPageSize
for each item in Folder.files
If iColumnSpan=4 Then
response.write "</tr><tr>"
iColumnSpan=0
End If
response.write "<td valign='top'>"
%>
<a id="example5" href="<%=ImagePath%>/<%=item.Name%>" title="<%=item.Name%>"><img src="<%=ImagePath%>/<%=item.Name%>" alt="Click To Enlarge" border="0" height="113" width="150" class="img"></a>
<!-- <img src="<%=ImagePath%>/<%=item.Name%>" alt="Click To Enlarge" border="0" height="113" width="150" class="img">--><br>
<span class="smallprint" style="padding-left:11px; display:block;"><%=item.Name%></span>
<br><br><br>
<%
response.write "</td>"
iColumnSpan=iColumnSpan + 1
next
response.write "</tr>"
Response.write "</table><br>"
' ---------------- END IMAGE VIEW -------------------------------
%>
<center><br><br></center>
<%
Else
' ---------------- START FOLDER VIEW ------------------------------- %>
<br>
<table width="680" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="247"><em>Folder</em></td>
<td width="303"><em>Last Modified</em></td>
</tr>
<tr>
<td colspan="2"><hr size=1></td>
</tr>
</table>
<table width="680" border="0" align="center" cellpadding="2" cellspacing="5" class="body1">
<tr valign="top">
<%
for each item in Folder.SubFolders
If right(item.Name,2) > "12" then
DirLabel = item.Name
SubProperty = item.Name
Else
FolderView = "eof"
SubProperty = Request.QueryString("subprop")
If right(item.Name,2) = "01" then DirLabel = "January " & left(item.Name,2) End If
If right(item.Name,2) = "02" then DirLabel = "February " & left(item.Name,2) End If
If right(item.Name,2) = "03" then DirLabel = "March " & left(item.Name,2) End If
If right(item.Name,2) = "04" then DirLabel = "April " & left(item.Name,2) End If
If right(item.Name,2) = "05" then DirLabel = "May " & left(item.Name,2) End If
If right(item.Name,2) = "06" then DirLabel = "June " & left(item.Name,2) End If
If right(item.Name,2) = "07" then DirLabel = "July " & left(item.Name,2) End If
If right(item.Name,2) = "08" then DirLabel = "August " & left(item.Name,2) End If
If right(item.Name,2) = "09" then DirLabel = "September " & left(item.Name,2) End If
If right(item.Name,2) = "10" then DirLabel = "October " & left(item.Name,2) End If
If right(item.Name,2) = "11" then DirLabel = "November " & left(item.Name,2) End If
If right(item.Name,2) = "12" then DirLabel = "December " & left(item.Name,2) End If
End If
%>
<td width="20" align="center"><img src="img/folder.gif" width="16" height="13"></td>
<td width="211"><%=DirLabel%></td>
<td width="308"><span class="smallprint"><%=item.DateLastModified%></span></td>
</tr>
<% Next %>
</table>
<br><br><br><br><br><br><br><br><br><br><br><br>
<%' ---------------- END FOLDER VIEW -------------------------------%>
<% End If %>
<br> </td>
</tr>
<tr>
<td align="center" valign="top"><br> </td>
</tr>
</table>
<br>
<%
function fit(text,length)
'function to make text fit a given length, so that it does not overflow the cell width.
If len(text)>(length-3) then
text=left(text,(length-3))
text=text&"..."
fit=text
else
fit=text
end if
end function
%>
</BODY>
</HTML>
<% End If %>
should the '**' be in your redirect url?
probably need more info really but the problem could be happening in the script that this one redirects to.
I am trying to insert data into a oracle database
The data gets inserted and updates the database, however the page throws an error each time the insert statement finished even though the database was updated?
How can i fix this bug? Thanks!
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
</head>
<body>
<div class="page">
<h1>Connie's Control Panel</h1>
<div class="header">
<form action="" method="POST">
<table>
<tr>
<td>Supplier You Want To Update:</td>
<td><input type="text" name= "supplierName" required ></td>
</tr>
<tr>
<td>Supplier Name Updated:</td>
<td><input type="text" name= "supplierNameUpdated" required></td>
</tr>
<tr>
<td>Supplier Address Updated:</td>
<td><input type="type" name="supplierAddressUpdated" required></td>
</tr>
<tr>
<td>Supplier Rating Updated:</td>
<td><input type="type" name="supplierRatingUpdated" required></td>
</tr>
</table>
<input type="submit" name="submit" value="Submit">
</form>
<%
Dim objConnection
Dim objRecordset
Dim objUpdateSet
Dim nameCheck
Dim nameUpdate
Dim addressUpdated
Dim ratingUpdated
nameCheck = Request.Form("supplierName")
nameUpdate = Request.Form("supplierNameUpdated")
addressUpdated = Request.Form("supplierAddressUpdated")
ratingUpdated = Request.Form("supplierRatingUpdated")
Set objConnection = Server.CreateObject("ADODB.Connection")
With objConnection
.ConnectionString = "Provider=MSDAORA.1;Password=DELETED;User ID=n011266e;Data Source=stora;Persist Security Info=True"
.Open
Set objRecordset = .Execute("SELECT * FROM Suppliers")
if nameCheck<>"" then
Do while (Not objRecordset.eof)
Set objRecordset = .Execute("UPDATE Suppliers SET SupplierName =" & "'" & nameUpdate &"'" & "WHERE SupplierName =" &"'" & nameCheck&"'")
objRecordset.MoveNext
Loop
end if
End With
objConnection.close
Set objConnection = Nothing
Set objRecordset = Nothing
Set objUpdateSet = Nothing
%>
</div>
<div class="buttons">
<i class="icon-white icon-pencil"></i> Enter Stock
Stock Report
<i class="icon-white icon-pencil"></i> View Suppliers Details
<i class="icon-white icon-pencil"></i> New Supplier
<i class="icon-white icon-pencil"></i> Edit Supplier
</div>
</div>
</body>
</html>
I guess you need not do "SELECT * FROM Suppliers" and Do while loop
you can directly execute
"UPDATE Suppliers SET SupplierName ='nameUpdate' WHERE SupplierName ='nameCheck' "
may be your getting error because your executing on "objRecordset = .Execute(.. ) " which already has select.
I need to test if a recordset has a next element before actually moving to it with
Recordset.MoveNext
EDIT:
I have some records, which are separated with an image but when it comes to the last record there is no need for the image that why I need to test if the record has a next one or it is the last one
<% while not Recordset.EOF
ItemId = Recordset.fields("ITEM_ID")
itemView= ItemId &" "& Recordset.fields("SHORT_DESC")
%>
<tr>
<td style="width:240px !important; word-break: break-all;">
<a href="view_work_item.asp?item_id=<%=ItemId%>&hometoURL=<% =Server.URLEncode(navpath & "/de/ticket/liste_ticket_pl.asp")%>" >
<%=titemView%></a></td>
<td background="../../images/white-dot.gif" ><img src="../../images/white-dot.gif" width="1" height="8" ></td>
<td style="width:240px !important; word-break: break-all;"><%=i%></td>
</tr>
//test here if it's the last element don't show this image
<tr>
<td align="center" class="subnav" colspan="3" height="1"><img src="../../images/white-dot.gif" width="100%" height="1"/></td>
</tr>
<% Recordset.MoveNext
wend %>
Use Recordset.EOF or BOF for begining
if not Recordset.EOF then
Recordset.MoveNext
end
To solve you problem try this.
<% while not Recordset.EOF
ItemId = Recordset.fields("ITEM_ID")
itemView= ItemId &" "& Recordset.fields("SHORT_DESC")
Recordset.MoveNext
%>
<tr>
<td style="width:240px !important; word-break: break-all;">
<a href="view_work_item.asp?item_id=<%=ItemId%>&hometoURL=<% =Server.URLEncode(navpath & "/de/ticket/liste_ticket_pl.asp")%>" >
<%=titemView%></a></td>
<td background="../../images/white-dot.gif" ><img src="../../images/white-dot.gif" width="1" height="8" ></td>
<td style="width:240px !important; word-break: break-all;"><%=i%></td>
</tr>
<% if not Recordset.EOF then %>
//test here if it's the last element don't show this image
<%end%>
<tr>
<td align="center" class="subnav" colspan="3" height="1"><img src="../../images/white-dot.gif" width="100%" height="1"/></td>
</tr>
<% wend %>
You could move your Recordset.MoveNext statement before your HTML and test it there. You've already saved the recordset values you need so advancing it early won't change anything. And I would think this would work better if you only have a single record, too, since it won't display the image delimiter.
If Not Recordset.EOF Then
Do While True
ItemId = Recordset.fields("ITEM_ID")
itemView= ItemId &" "& Recordset.fields("SHORT_DESC")
Recordset.MoveNext
If Recordset.EOF Then Exit Do
' HTML code here
Loop
End If
I'm very new to VBScript or any scripting for that matter.
I want the script to check whether an image is loaded. Below is the script up to the point of where I'm stuck.
strURL="https://www.Test.com/"
strUser="******"
strPass="******"
Set oIE = WScript.CreateObject("InternetExplorer.Application","IE_")
Timeout=20 'seconds
oIE.visible=1 : BeginTimer = Timer
oIE.Navigate strURL
i=0 : bElementsLoaded=false
Set CODA_Element_1 = Nothing
Do While (oIE.ReadyState<>4 Or Not(bElementsLoaded)) And i < Timeout
WScript.Sleep(1000):i=i+1
On Error Resume Next
Set CODA_Element_1 = oIE.Document.getElementById("user")
Set CODA_Element_2 = oIE.Document.getElementById("password")
Set CODA_Element_3 = oIE.Document.getElementById("next")
If (Not(CODA_Element_1 is Nothing)) Then
bElementsLoaded=true
End If
On Error Goto 0
Loop
CODA_Element_1.value=strUser
CODA_Element_2.value=strPass
CODA_Element_3.Click()
From here on in i have no idea.... The image i want to check is loaded is /codaprod/images/portal.jpg
In the below snippet of source code
<DIV id="esisplitpanelower" class="scroller" style="height:100%; overflow:auto">
<TABLE cellpadding=0 cellspacing=0 height="100%" width="100%">
<TR><TD width="100%" height="100%"><TABLE cellpadding=0 cellspacing=0 height="100%" width="100%">
<TR><TD align="center" valign="top" width="100%" height="100%"><TABLE cellpadding=0 cellspacing=3 align="center" valign="top" height="100%" width="100%">
<TR><TD align="center" width="100%" height="100%"><TABLE cellpadding=0 cellspacing=3 align="center" height="100%" width="100%">
<TR><TD align="center"><IMG src="/codaprod/images/portal.jpg" title="Home Page">
</TD>
</TR></TABLE>
</TD>
</TR></TABLE>
</TD>
</TR></TABLE>
</TD>
</TR></TABLE>
</DIV>
Can somebody please show me how to check if this image is loaded? If loaded display msgbox "Working!" and if the image is not loaded then msgbox "Not Working!"
One way is to use <img>'s onload() method.
<script type="text/vbscript">
sub loadImage()
msgbox "Image is loaded"
end sub
</script>
<img src="anyold.gif" onload="loadImage">
W3Schools gives a JavaScript version of that same thing: http://www.w3schools.com/jsref/event_img_onload.asp
You can check using the image object's complete property
http://www.w3schools.com/jsref/prop_img_complete.asp
Here's an example:
For Each pix In oIE.document.images
Do Until pix.complete=true
WScript.Sleep 10
Loop
Next
You need to tailor this to your precise image, possibly comparing the image object's src property for checking the precise image you want to know if it is loaded or not.