按键精灵mysql_mysql,按键精灵,读取写⼊Function connOpen()
Set conn = CreateObject("ADODB.Connection")
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=localhost;" & "UID=root; PWD=root; OPTION=3; DATABASE=demo;stmt=SET NAMES GB2312" '注意ODBC驱动版本号,现在最新的 MySQL 5.4 + ODBC 5.1
'另外可以有 DATABASE=XX,或者在程序⾥使⽤ use database 语句
'OPTION是什么作⽤不知道,我这⾥可以不写
conn.Open
Set rs = CreateObject("ADODB.Recordset")
End Function
//执⾏记录
Function mysql_query(sql)
Call connOpen()
conn.Execute sql
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
End Function
//获取数据列表
Function mysql_list(sql)
Call connOpen()
rs.Open sql, conn
While rs.EOF = False '如果EOF为真,则表⽰"游标"已经在最后⼀条记录后⾯。
MsgBox ("user_name:" & rs("neirong") & "||password:" & rs("time"))
rs.MoveNext
Wend
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
End Function
//写⼊
Call mysql_query("INSERT INTO anjian_mysql(`id`,`neirong`) values('3','参数保存的不错就是有提⽰错误')")
//读取
Call mysql_list("select * from anjian_mysql")
Sub 按时进⾏
Do
NowTime = Time
TracePrint NowTime
SWTime = "19:45:20"//你要的设置的时间,也可作为变量随意
If Hour(SWTime) = Hour(NowTime) and Minute(SWTime) = Minute(NowTime) and Second(SWTime) = Second(NowTime) Then
Exit Do
End If
Delay 1000
Loop
MessageBox "开始执⾏了"
RunApp "www.ajjl"
//或者⽤ RunApp "IEXPLORE.EXE"mysql下载app
Delay 1000
Rem 选择窗⼝
Hwnd = Plugin.Window.Foreground()
stemp=Plugin.Window.GetClass(Hwnd)
If stemp="IEFrame" then
MessageBox "接下来演⽰关闭⽹页"
Call Plugin.Window.CloseEx(Hwnd)
Else
Delay 300
Goto 选择窗⼝
End If
//或者⽤以下简单⽅法
Delay 2000
Call Plugin.Web.Bind("")
Call Plugin.Web.Go("www.ajjl")
Delay 2000
MessageBox "接下来演⽰关闭⽹页"
Hwnd=Plugin.Web.GetHwnd() Call Plugin.Window.Close(Hwnd) End Sub
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论