SELECT * FROM information_schema.tables SQL Server 2000:SELECT * FROM sysobjects WHERE xtype='U'
SELECT * FROM information_schema.tables SQL Server 2000:SELECT * FROM sysobjects WHERE xtype='U'
SETLOCAL ENABLEDELAYEDEXPANSION SET String=Abc SET String CALL :UpCase String SET String CALL :LoCase String SET String ENDLOCAL GOTO:EOF :LoCase :: Subroutine to convert a variable VALUE to all lower case. :: The argument for this subroutine is the variable NAME. SET %~1=!%1:A=a! SET %~1=!%1:B=b! SET %~1=!%1:C=c! SET %~1=!%1:D=d! SET %~1=!%1:E=e! SET %~1=!%1:F=f! SET %~1=!%1:G=g! SET %~1=!%1:H=h! SET %~1=!%1:I=i! SET %~1=!%1:J=j! SET %~1=!%1:K=k! SET %~1=!%1:L=l! SET %~1=!%1:M=m! SET %~1=!%1:N=n! SET %~1=!%1:O=o! SET %~1=!%1:P=p! SET %~1=!%1:Q=q! SET %~1=!%1:R=r! SET %~1=!%1:S=s! SET %~1=!%1:T=t! SET %~1=!%1:U=u! SET %~1=!%1:V=v! SET %~1=!%1:W=w! SET %~1=!%1:X=x! SET %~1=!%1:Y=y! SET %~1=!%1:Z=z! GOTO:EOF :UpCase :: Subroutine to convert a variable VALUE to all upper case. :: The argument for this subroutine is the variable NAME. SET %~1=!%1:a=A! SET %~1=!%1:b=B! SET %~1=!%1:c=C! SET %~1=!%1:d=D! SET %~1=!%1:e=E! SET %~1=!%1:f=F! SET %~1=!%1:g=G! SET %~1=!%1:h=H! SET %~1=!%1:i=I! SET %~1=!%1:j=J! SET %~1=!%1:k=K! SET %~1=!%1:l=L! SET %~1=!%1:m=M! SET %~1=!%1:n=N! SET %~1=!%1:o=O! SET %~1=!%1:p=P! SET %~1=!%1:q=Q! SET %~1=!%1:r=R! SET %~1=!%1:s=S! SET %~1=!%1:t=T! SET %~1=!%1:u=U! SET %~1=!%1:v=V! SET %~1=!%1:w=W! SET %~1=!%1:x=X! SET %~1=!%1:y=Y! SET %~1=!%1:z=Z! GOTO:EOF
Dim FSO, dFile, sHTML
sHTML = Get_HTML ("http://www.google.com")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set dFile = FSO.CreateTextFile("SaveFile.html", True)
dFile.Write UniToAsc(sHTML)
dFile.Close
Set dFile = Nothing
Set FSO = Nothing
Private Function Get_HTML (up_http)
Dim xmlhttp
Set xmlhttp = createobject("msxml2.xmlhttp.6.0")
xmlhttp.open "get", up_http, False
xmlhttp.send
Get_HTML = xmlhttp.responsetext
set xmlhttp = Nothing
End Function
Private Function UniToAsc(sString)
Dim nLen, nPTR, sAsc
nLen = Len(sString)
For nPTR = 1 To nLen
sAsc = sAsc & Chr(Asc(Mid(sString, nPTR, 1)))
Next
UniToAsc = sAsc
End Function
Imports System.Diagnostics Imports System.IO Partial Class RunBatchFile Inherits System.Web.UI.Page Dim _password As New System.Security.SecureString Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim password As String 'Read from any Registry or Encrypted config file if you like for added security. password = "YOUR___PASSWORD" For Each c As Char In password _password.AppendChar(c) Next Dim strFilePath As String = "c:\\temp\\test.bat" Dim psiMyProcess As ProcessStartInfo = New ProcessStartInfo("cmd.exe") psiMyProcess.LoadUserProfile = True psiMyProcess.UserName = "Administrator" psiMyProcess.Password = _password psiMyProcess.UseShellExecute = False psiMyProcess.CreateNoWindow = True psiMyProcess.RedirectStandardOutput = True psiMyProcess.RedirectStandardInput = True psiMyProcess.RedirectStandardError = True psiMyProcess.WorkingDirectory = "c:\\temp\\" Dim prcProcess As Process = Process.Start(psiMyProcess) Dim strm As StreamReader = File.OpenText(strFilePath) Dim strOut As StreamReader = prcProcess.StandardOutput Dim strIn As StreamWriter = prcProcess.StandardInput Do While strm.Peek() <> -1 strIn.WriteLine(strm.ReadLine()) Loop strm.Close() strIn.WriteLine(String.Format("# {0} ran successfully. Exiting now!", strFilePath)) strIn.WriteLine("Exit") prcProcess.Close() Dim strOutput As String = strOut.ReadToEnd().Trim() strIn.Close() strOut.Close() Response.Write(String.Format("<font face=courier size=0>{0}</font>", _ strOutput.Replace(System.Environment.NewLine, "<br>"))) End Sub End Class
Reference:http://dotnetscraps.com/dotnetscraps/post/Run-a-batch-file-as-a-specific-User-(or-Administrator)-from-ASPNET.aspx
<%@ Page Language="VB" %>
<!DOCTYPE html>
<script runat="server">
Sub submit(sender As Object, e As EventArgs)
If row2.Visible = False Then
row2.Visible = True
Else
row2.Visible = False
End If
End Sub
</script>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="id" Text="Submit" OnClick="submit" runat="server" />
<div>
<table border="1">
<tr id="row1" runat="server">
<td>1</td><td>2</td><td>3</td>
</tr>
<tr id="row2" runat="server">
<td>4</td><td>5</td><td>6</td>
</tr>
<tr id="row3" runat="server">
<td>7</td><td>8</td><td>9</td>
</tr>
<tr id="row4" runat="server">
<td>10</td><td>11</td><td>12</td>
</tr>
</table>
</div>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html>
<script runat="server">
Sub submit(sender As Object, e As EventArgs)
If row2.Visible = False Then
row2.Visible = True
Else
row2.Visible = False
End If
End Sub
</script>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:Button ID="id" Text="Submit" OnClick="submit" runat="server" />
<div>
<table border="1">
<tr id="row1" runat="server">
<td>1</td><td>2</td><td>3</td>
</tr>
<tr id="row2" runat="server">
<td>4</td><td>5</td><td>6</td>
</tr>
<tr id="row3" runat="server">
<td>7</td><td>8</td><td>9</td>
</tr>
<tr id="row4" runat="server">
<td>10</td><td>11</td><td>12</td>
</tr>
</table>
</div>
</form>
</body>
</html>
<%@ Page Language="VB" %>
<!DOCTYPE html>
<script runat="server">
Sub submit(sender As Object, e As EventArgs)
lbl1.Text = "Hello " & name.Text & "!"
End Sub
</script>
<html>
<head>
<title>Test Main</title>
</head>
<body>
<form id="form1" name="myForm" method="post" action="default.aspx" runat="server">
<div>
Hello World!
</div>
Your name: <asp:TextBox id="name" runat="server" />
<asp:Button ID="id" Text="Submit" OnClick="submit" runat="server" />
<p><asp:Label id="lbl1" runat="server" /></p>
</form>
</body>
</html>