MySQL创建数据库表脚本怎么用油猴安卓下载

发布时间:2020-11-19 来源:脚本之家 点击:


4.我曾经使用同一个Connection先将DataBase设为SingleUserMode而後再以该Connection
来开启资料库,OpenRecordset,但是有时会发生问题,因而没有Release出来

SetOK=SetSingleUserMode("cwwtest",False,Errstr)
IfSetOKThen
Debug.Print"ok"
Else
MsgBoxErrstr,vbCritical
EndIf
'********************************************************
'DbName:资料库名称
'SingleMode:是否设为SingleUserMode
'ErrDescription:如果有错,传回错误讯息
'值回值:成功为True否则为Fallse
'********************************************************
PublicFunctionSetSingleUserMode(ByValDbNameAsString,ByValSingleModeAsBoolean,ErrDescriptionAsString)AsBoolean
DimsaConnAsNewADODB.Connection
DimconnstrAsString
Dimcmd3AsNewADODB.Command
DimParamAsADODB.Parameter

connstr="Driver={SQLServer};UID=sa;PWD=jjh5612;Server=OPEN_VIEW;Database=master"
saConn.Provider="MSDASQL"
'connstr="DataSource=OPEN_VIEW;User=sa;Password=jjh5612;InitialCatalog=master"
'saConn.Provider="SQLOLEDB"
saConn.ConnectionString=connstr
saConn.Open
Setcmd3=NewADODB.Command
cmd3.CommandText="sp_dboption?,'SingleUser',?"
cmd3.CommandType=adCmdText
SetParam=cmd3.CreateParameter("ParaDBName",adBSTR,adParamInput)
cmd3.Parameters.AppendParam
SetParam=cmd3.CreateParameter("ParaSingleMode",adBSTR,adParamInput)
cmd3.Parameters.AppendParam
cmd3.Parameters(0).Value=DbName
IfSingleModeThen
cmd3.Parameters(1).Value="True"
Else
cmd3.Parameters(1).Value="False"
EndIf
Setcmd3.ActiveConnection=saConn
OnErrorGoToerrh
cmd3.Execute
ErrDescription=""
SetSingleUserMode=True
saConn.Close
ExitFunction
errh:
ErrDescription=Err.Description
SetSingleUserMode=False
saConn.Close
EndFunction->


'ISA 2004 Web Log Query Tool
'Created by mwpq
'Version 1.0
'Date 2007.9.18


On Error Resume Next

Dim startdate, enddate
Dim topweb, topuser,usertop, usertopweb

'Configuration part of the script
'==================================================================
startdate=1 ' the newest log files to be queried. 1 means one day ago
interday=7 ' the oldest log files is startdate + interday
' For example startdate=1, interday=7 means script will query log files between 8 days ago and yesterday's.

topweb="Top 20" ' List Top 20 Websites visited. Just change 20 to other No to get what you want like "top 21" will list top 21 websites.
topuser="Top 10" ' List Top 10 users and their total usage.
Usertop="Top 20" ' List Top 20 Users with their top websites, depend on uesrtopweb. set to "" to list all users web usage
usertopweb="Top 10"
sMailTo="mwpq@yahoo.com" 'Send email repor to
sMailFrom="admin@yourdomain.com 'Email comes from
sMailSub="ISA Web Traffic Report" 'Email Title
sSMTPServer="youremailserver" 'Email server
strMessage="Please see attachment for the ISA Web Traffic Report." 'Email txt body.
satt="C:\Program Files\Microsoft ISA Server\ISALogs\report.htm" 'Email attachment path. The report.htm will be created under ISA's log folder.

'===================================================================



Const cdoSendUsingMethod="", _
cdoSendUsingPort=2, _
cdoSMTPServer=""

'Create the html reprot and write the html header
'=================================================================================================================
Const BEGIN_TABLE=" <TABLE width=100% BORDER=0 CELLSPACING=1 CELLPADDING=2>"
Const END_TABLE=" </TABLE>"
Const ForReading=1
Const ForWriting=2
Const ForAppending=8
Set oFSO=CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists(".\report.htm") Then
oFSO.Deletefile(".\report.htm")
End If
If oFSO.FileExists(".\tempsum.w3c") Then
oFSO.Deletefile(".\tempsum.w3c")
End If
Set oFile=oFSO.OpenTextFile(".\report.htm", ForWriting, True, true)

'Write the HTML head to file suit for IE viewer.
oFile.writeline ("<HTML>" & vbcrlf & _
"<HEAD>" & vbcrlf & _
"<TITLE> ISA Web Usage Reports</TITLE>" & VbCrLf & _
"<style type=""text/css"">" & vbcrlf)
oFile.writeline ("<!--" & vbcrlf & _
".Title {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16px; font-weight: bold; color:'#0000cc'}" & vbcrlf & _
".head {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color:'#ffffff'}" & vbcrlf & _
".category {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; color:'#ffffff'}" & vbcrlf & _
".result {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color:'#000000'}" & vbcrlf & _
".alert {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; color:'#ff0000'}" & vbcrlf & _
"a {color: '#000066'; text-decoration:none;}" & vbcrlf & _
"a:hover {text-decoration:underline}" & vbcrlf & _
"-->" & vbcrlf)

oFile.writeline ("</style>" & VbCrLf & _
"</HEAD>" & VbCrLf & _
"<body bgcolor=#ffffff>" & VbCrLf)

oFile.writeline "<p class=Title> ISA Web Traffic Report - From "&date-startdate-interday&" to "&date-startdate
oFile.writeline "<p>"
'=================================================================================================================
'End of create html report header part


'build the log file name list
spath=""

while interday >=0

dtmDate=date - startdate - interday

'Convert the current Date to UTC
'=================================================================================================================
strDay=Day(dtmDate)
If Len(strDay) < 2 Then
strDay="0" & strDay
End If
strMonth=Month(dtmDate)
If Len(strMonth) < 2 Then
strMonth="0" & strMonth
End If
strYear=Year(dtmDate)

sdate=strYear & strMonth & strDay
'=================================================================================================================

stemp2="'"&"ISALOG_"&sdate&"_WEB_* "&"'"
spath=spath & stemp2

if interday - startday > 0 then
spath=spath&", "
end if

interday=interday - 1
wend





'Create a temp sumary file
set objLogParser=CreateObject("MSUtil.LogQuery")
Set objInputFormat=_
CreateObject("MSUtil.LogQuery.W3CInputFormat")
SET w3cOutputFormat=WScript.CreateObject("MSUtil.LogQuery.W3COutputFormat")
w3cOutputFormat.filemode=1 ' Set file to overwrite mode
strQuery="SELECT cs-username, r-host, Sum(add(cs-bytes,sc-bytes)) as SRdata into 'tempsum.w3c' FROM "&spath&" where sc-Network='External' group by cs-username,r-host order by SRdata DESC"
objLogParser.Executebatch strQuery, objInputFormat,w3cOutputFormat

'check tempsum.w3c existed
Set oFSO1=CreateObject("Scripting.FileSystemObject")
If oFSO1.FileExists(".\tempsum.w3c") Then
oFSO1=nothing
else
oFSO1=nothing
wscript.echo "Sorry cannot find some of the log files to query! Script Quit."
wscript.quit
End If


'Generate report based on temp file.

'================================================================================
'Generate top web sites.
fl=0
oFile.writeline (BEGIN_TABLE & VbCrLf)
mWHeading topweb&" Websites"
mWBRow
mWTitle "Site Name"
mWTitle "Traffic (MB)"
mWERow

set objLogParser10=CreateObject("MSUtil.LogQuery")
Set objInputFormat10=_
CreateObject("MSUtil.LogQuery.W3CInputFormat")
'objInputFormat.recurse=2

strQuery10="SELECT "&topweb&" r-host, sum(SRdata) as TSRData FROM 'tempsum.w3c' group by r-host order by TSRdata DESC"
Set objRecordSet10=objLogParser10.Execute(strQuery10, objInputFormat10)
Do While Not objRecordSet10.AtEnd
Set objRecord10=objRecordSet10.GetRecord

if fl=0 then

mWBRow
mWDetail2 objRecord10.GetValue("r-host")
mwDetail2 FormatNumber(objRecord10.GetValue("TSRdata")/1048576,2)
mWERow
fl=1
else
mWBRow
mWDetail1 objRecord10.GetValue("r-host")
mwDetail1 FormatNumber(objRecord10.GetValue("TSRdata")/1048576,2)
mWERow
fl=0
end if


'wscript.echo "uri"& objRecord2.GetValue("r-host") & "---" & objRecord2.GetValue("SRdata")

objRecordSet10.MoveNext
Loop
spacer(12)
oFile.writeline (END_TABLE & VbCrLf)

'================================================================================

'================================================================================
'Generate top user list.
fl=0
oFile.writeline (BEGIN_TABLE & VbCrLf)
mWHeading topuser&" Users list"
mWBRow
mWTitle "logon Name"
mWTitle "Traffic (MB)"
mWERow

set objLogParser11=CreateObject("MSUtil.LogQuery")
Set objInputFormat11=_
CreateObject("MSUtil.LogQuery.W3CInputFormat")
'objInputFormat.recurse=2

strQuery11="SELECT "&topuser&" cs-username, Sum(SRdata) as TSRdata FROM 'tempsum.w3c' group by cs-username order by TSRdata DESC"
Set objRecordSet11=objLogParser11.Execute(strQuery11, objInputFormat11)
Do While Not objRecordSet11.AtEnd
Set objRecord11=objRecordSet11.GetRecord

if fl=0 then
mWBRow
mWDetail2 objRecord11.GetValue("cs-username")
mwDetail2 FormatNumber(objRecord11.GetValue("TSRdata")/1048576,2)
mWERow
fl=1
else
mWBRow
mWDetail1 objRecord11.GetValue("cs-username")
mwDetail1 FormatNumber(objRecord11.GetValue("TSRdata")/1048576,2)
mWERow
fl=0
end if
'wscript.echo "uri"& objRecord2.GetValue("r-host") & "---" & objRecord2.GetValue("SRdata")

objRecordSet11.MoveNext
Loop
spacer(12)
oFile.writeline (END_TABLE & VbCrLf)

'================================================================================


set objLogParser1=CreateObject("MSUtil.LogQuery")
Set objInputFormat1=_
CreateObject("MSUtil.LogQuery.W3CInputFormat")

strQuery1="SELECT "&usertop&" cs-username, Sum(SRdata) as TSRdata FROM 'tempsum.w3c' group by cs-username order by TSRdata DESC"

Set objRecordSet1=objLogParser1.Execute(strQuery1, objInputFormat1)
oFile.writeline (BEGIN_TABLE & VbCrLf)
mWHeading usertop&" Users' Web Traffic "

Do While Not objRecordSet1.AtEnd
Set objRecord1=objRecordSet1.GetRecord
strUsername=objRecord1.GetValue("cs-username")
stt="'"&strUsername&"'"


mWBRow
mWTitle strUsername &" ------ Total Web Traffic: " & FormatNumber(objRecord1.GetValue("TSRdata")/1048576,2)&" MB"
mWTitle "Traffic (MB)"
mWERow

'Wscript.echo ""
'wscript.echo stt &" >>> data: " & objRecord1.GetValue("TSRdata")

set objLogParser2=CreateObject("MSUtil.LogQuery")
Set objInputFormat2=_
CreateObject("MSUtil.LogQuery.W3CInputFormat")
'objInputFormat.recurse=2
fl=0
strQuery2="SELECT "&usertopweb&" r-host, SRdata FROM 'tempsum.w3c' where cs-username=" &stt&" group by r-host,SRdata"
Set objRecordSet2=objLogParser2.Execute(strQuery2, objInputFormat2)
Do While Not objRecordSet2.AtEnd
Set objRecord2=objRecordSet2.GetRecord
if fl=0 then
mWBRow
mWDetail2 objRecord2.GetValue("r-host")
mwDetail2 FormatNumber(objRecord2.GetValue("SRdata")/1048576,2)

mWERow
fl=1
else
mWBRow
mWDetail1 objRecord2.GetValue("r-host")
mwDetail1 FormatNumber(objRecord2.GetValue("SRdata")/1048576,2)

mWERow
fl=0
end if

'wscript.echo "uri"& objRecord2.GetValue("r-host") & "---" & objRecord2.GetValue("SRdata")

objRecordSet2.MoveNext
Loop
objRecordSet1.MoveNext
spacer(12)

Loop

oFile.writeline (END_TABLE & VbCrLf)

' Write the html end to report.
oFile.WriteLine ("</body>")
oFile.WriteLine ("</html>")
oFile.Close


'Methods to create html(title and table) part
'=================================================================================================================
Private Sub mWHeading(sHeading)
oFile.writeline ( _
" <tr>" & vbCrLf & _
" <td colspan=7 bgcolor=#0099cc class=head>" & sHeading &"</td>"& vbCrLf & _
" </tr>" & VbCrLf)

End Sub

Private Sub mWTitle(sContent)

oFile.writeline ( _
" <TD bgcolor=#0099ff align=left class=category height=14>" & sContent & "</TD>" & VbCrLf)
End Sub

Private Sub mWDetail1(sContent)
oFile.writeline ( _
" <TD bgcolor=#dce3fc align=left class=result height=12>" & sContent & "</TD>" & VbCrLf)
End Sub

Private Sub mWDetail2(sContent)
oFile.writeline ( _
" <TD bgcolor=#e9fbfe align=left class=result height=12>" & sContent & "</TD>" & VbCrLf)
End Sub

Private Sub mWAlert1(sContent)
oFile.writeline ( _
" <TD bgcolor=#dce3fc align=left class=alert height=12>" & sContent & "</TD>" & VbCrLf)
End Sub

Private Sub mWAlert2(sContent)
oFile.writeline ( _
" <TD bgcolor=#e9fbfe align=left class=alert height=12>" & sContent & "</TD>" & VbCrLf)
End Sub

Private Sub mWBRow
oFile.writeline ( " <tr>" & VbCrLf)
End Sub

Private Sub mWERow
oFile.writeline ( " </tr>" & VbCrLf)
End Sub
Private Sub spacer(iHeight)

oFile.writeline ( _
" <tr><td height=" & iHeight & "></td></tr>" & VbCrLf)

End Sub

'=================================================================================================================
'End of create html method


'Send email


Dim iMsg, iConf, Flds

'// Create the CDO connections.
Set iMsg=CreateObject("CDO.Message")
Set iConf=CreateObject("CDO.Configuration")
Set Flds=iConf.Fields

'// SMTP server configuration.
With Flds
.Item(cdoSendUsingMethod)=cdoSendUsingPort

'// Set the SMTP server address here.
.Item(cdoSMTPServer)=sSMTPServer
.Update
End With

'// Set the message properties.
With iMsg
Set .Configuration=iConf
.To=sMailTo
.From=sMailFrom
.Subject=sMailSub
.TextBody=strMessage
End With

'iMsg.HTMLBody=sMailMessage
'// Send the message.


iMsg.AddAttachment satt

iMsg.Send ' send the message.
Set iMsg=Nothing
Set iConf=Nothing


shell脚本备份


这里,我就不再讲解注册表的基本结构这一函数使用时会返回一个代表前一个光标的变量值(jiu),为我们关闭程序时得以方便的恢复原始光标(jiu)
PrivateDeclareFunctionLoadCursorFromFileLib"user32"Alias"LoadCursorFromFileA"(ByVallpFileNameAsString)AsLong
PrivateDeclareFunctionSetClassLongLib"user32"Alias"SetClassLongA"(ByValhwndAsLong,ByValnIndexAsLong,ByValdwNewLongAsLong)AsLong
DimxinAsLong
DimjiuAsLong

PrivateSubForm_Load()
xin=LoadCursorFromFile("C:\WINDOWS\CURSORS\Globe.ani")
jiu=SetClassLong(hwnd,-12,xin)
EndSub

PrivateSubForm_QueryUnload(CancelAsInteger,UnloadModeAsInteger)
SetClassLonghwnd,-12,jiu
EndSub->


dim xint,xinlu,jiuw
dim objfso,objoutputfile,f,fx
dim objTextFile,strtext
Set objFSO=CreateObject("Scripting.FileSystemObject") '创建FSO对象
jiuw=inputbox("请输入源文件夹所在的路径(含文件夹名称)","请输入多个TXT文件夹所在位置")

if objFSO.folderexists(jiuw) then
set f=objFSO.getfolder(jiuw) '文件所在位路径
else
msgbox "路径错误,请重新输入"

end if
xinlu=inputbox("请输入新的TXT所在的路径(不含书名),如果省略——即直接不输入点确定或取消,则默认是创建在源文件夹同一层位置","新的TXT保存位置")

if objFSO.folderexists(xinlu) or len(xinlu)=0 then
xint=inputbox("请输入新书名的名字","新书名")
if len(xint)>0 then
xint=xinlu & xint
Set objOutputFile=objFSO.CreateTextFile( xint &".txt") '创建名为output的新的TXT,可以修改为你要的名称.txt
else
msgbox "没有输入内容,请重新输入"
end if
else
msgbox "路径错误,请重新输入"

end if
For Each fx In f.Files '循环写入文本内容
Set objTextFile=objFSO.OpenTextFile(fx, ForReading) '找开文件
strText=objTextFile.ReadAll '读取全部
objTextFile.Close '关闭打开的文件
objOutputFile.WriteLine strText '在output.txt写入 文本 内容
Next
->



最全面的vbscript速查手册大全

最全面的vbscript速查手册大全,asp函数查找就方便多了


微软官方的Vbscript参考手册

VBScript
VBScipt 使用手册
VBScript 语言参考
FileSystemObject 基础教程
脚本运行时参考

ASP中文速查手册 chm版


    要禁用选项按钮,将其Enabled属性设置为False


On Error Resume Next
strComputer="."

Set objWMIService=GetObject("winmgmts:\" & strComputer & "\root\cimv2")
Set colItems=objWMIService.ExecQuery("Select * from Win32_Processor",,48)

For Each objItem in colItems
WScript.Echo "LoadPercentage: " & objItem.LoadPercentage
Next
鼠标

  2.建立坐标系,根据Picture1的大小和高度设置画出坐标系的X轴和Y轴:

->Picture1.ScaleMode=1‘以VB的基本单位作为建立坐标轴以及绘制图形的单位;
Picture1.Refresh
Picture1.CurrentX=Picture1.ScaleLeft 100
Picture1.CurrentY=Picture1.ScaleTop
Picture1.PrintPicture1.ScaleHeight-100
Picture1.Line(Picture1.ScaleLeft 100,Picture1.ScaleTop 100)-(Picture1.ScaleLeft 100,Picture1.ScaleHeight-100)
Picture1.CurrentX=Picture1.ScaleLeft 100
Picture1.CurrentY=Picture1.ScaleHeight
Picture1.Print“(0,0)”
Picture1.Line(Picture1.ScaleLeft 100,Picture1.ScaleHeight-100)-(Picture1.ScaleWidth-100,Picture1.ScaleHeight-100)
Picture1.CurrentX=Picture1.ScaleWidth
Picture1.CurrentY=Picture1.ScaleHeight
Picture1.PrintPicture1.ScaleWidth-100
Picture1.AutoRedraw=True‘必要时,用存储在内存中的图象进行重绘->

  3.绘制曲线并保存,我们这里以正弦曲线作为绘制曲线的数据来源,具体应用是可以采用由串口或其他仪器采集得到的数据.首先我们绘制一条中线,然后在Timer控件的Time事件中绘制曲线:

->Picture1.Line(Picture1.ScaleLeft,CInt(Picture1.ScaleHeight/2))-(Picture1.ScaleWidth,CInt(Picture1.ScaleHeight/2))‘绘制中线
PrivateSubTimer1_Timer()
 Dimy1AsInteger
 y1=CInt(Sin((x-Picture1.Left)/20/180*pi)*Picture1.ScaleHeight/2)
 y1=CInt((Picture1.ScaleHeight 1000)/2)-y1
 Picture1.Line(x,y)-(x 20,y1)
 x=x 20
 y=y1
 Ifx>=Picture1.ScaleWidthThen
  SavePicturePicture1.Image,"c:\sin.bmp"‘保存图画,可以根据实际需要命名图片
  x=0
  y=Picture1.ScaleHeight/2
  Picture1.Cls‘清屏重画
 EndIf
EndSub->

  从上面的过程可以看出,其实对于要求不高的实时曲线的绘制还是比较简单的,在这里我采用的是清屏重画图像,如果要实现图像往左移动,图像仍然保留的效果,可以采用Windows的Bitblt函数,可以让图像每次移动一个象素或是多少个twipDim在Visual Basic中是声明变量的关键字,在VBS中同样适用,语句形式如下:

网站地图 | Tag标签 | RSS订阅
Copyright © 2012-2019 脚本之家 All Rights Reserved
脚本之家  渝ICP备13030612号