Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
masterzin
Starting Member
2 Posts |
Posted - 2008-04-29 : 13:25:11
|
| Ok, I have tried everything to make this work, including a very extensive search on the web to no avail.What I am trying to do, is through a web page a created, auto pull 3 tables out of a SQL view and display the data real time. This part works, and I am further able to create dynamic hyperlinks based on the data pull.Where the problem arises is in creating a submit button that will run an application. The code to do this is dependent on the running SQL query loop. Here is what I have._______________________________________________________________<html><head><title>Computer / MAC Address Pull</title><meta name="Microsoft Theme" content="none"><meta name="Microsoft Border" content="none"></head><body><P><H2 ALIGN= CENTER>Computer / MAC Address Pull</H2></P><TABLE WIDTH= '90%' BORDER='0'ALIGN= CENTER> <TR><TD WIDTH= '10%'Align=center><B>Computer Name</TD> <TD WIDTH= '8%'Align=center><B>IP Address</TD> <TD WIDTH= '10%'Align=center><B>Mac Address</TD> <TD width= '8%'Align=center><b>Power On</TD> <TD width= '8%'Align=center><b>Count</TD> </TABLE><%dim rsdim intint = 1dim inputdataSent = Request.Form("t1") cString = "Provider=SQLOLEDB;User Id=****;password=****;Initial Catalog=dareporting;Data Source=****;" set rs = CreateObject("ADODB.Recordset") rs.open "select computer, address, mac from view_mac_address" ,cStringrs.MoveFirstResponse.Write "<input type=textbox id=sqlsearch>"Response.Write "<input type=button value=submit id=submit>"function WOL()Dim Inputinput = rs("mac")Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "C:\mc-wol.exe " & inputend functionResponse.Write "<TABLE WIDTH= '90%' BORDER='1'ALIGN= CENTER cellspacing=0 cellpadding=0 mso-border-alt:solid navy >"Do while NOT rs.EOF dim mac1 Set WshShell = WScript.CreateObject("WScript.Shell") 'mac1="WshShell.Run 'C:\mc-wol.exe ' &rs('mac')" mac2="WshShell.Run 'C:\mc-wol.exe ' &rs('mac')" Response.Write "<TR><TD WIDTH= '10%'Align=center><a href='https://"&rs("address")&":2000'>" & rs("computer") & "</TD>" Response.Write "<TD WIDTH= '8%'Align=center>" & rs("address") & "</TD>" Response.Write "<TD WIDTH= '10%'Align=center>" & rs("mac") & "</TD>" 'Response.Write "<TD WIDTH= '8%'Align=center><input type=button value='start' onclick='WOL()'></TD>" Response.Write "<TD WIDTH= '8%'Align=center><input type=button value='start' onclick="&mac2&"></TD>" Response.Write "<TD WIDTH= '8%'Align=center>" & int & "</TD>" int = int + 1 rs.MoveNextLoopResponse.Write "</TABLE>"%><p></p></body></html>___________________________________________________________Essentially what this does, is display with headers, a listing of my domains computer names, IP addresses, MAC Addresses, and a Start button. Since this is tied to my SQL database you wont be able to view the output, but what I want to do is, in the loop, have the Start button grab the running mac addresses and place it into the following code:__________________________________________________________Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "C:\mc-wol.exe " &rs("mac")__________________________________________________________This will allow me to (I hope), on click, open a command prompt, run the code with the respective mac address, and start the computer.Where the problem lies, is that I can not figure out how to encapsulate the mac address inside that code while in the loop... any ideas would be greatly appreciated! If you have any questions, please let me know. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-04-29 : 14:23:02
|
| why don't you pass a parameter to the WOL function?function WOL(byval input)Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "C:\mc-wol.exe " & inputend functionResponse.Write "<TD WIDTH= '8%'Align=center><input type=button value='start' onclick='WOL(" & rs("mac") & ")'></TD>"_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
masterzin
Starting Member
2 Posts |
Posted - 2008-04-29 : 17:05:04
|
| I tried that before, but it did not work. I copied your code to try it again and the error I got was:Microsoft VBScript runtime error '800a01a8' Object required: '' /Data Pulls/wol.asp, line 51 Any ideas? |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-04-29 : 17:10:18
|
well this is the way to go. you'll have to play to get the syntax right.my VBscript is a little rusty _______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
 |
|
|
|
|
|
|
|