ODBC驱动可以搜索“数据库类型 windows ODBC 插件”安装;DSN需要在开始菜单,Windows管理工具中找“ODBC 数据源(32 位)”,此处如果用32位的AHK则用32位的版本添加,不然无法访问。
a := new adodb a.open("DSN=testdb;UID=thinkai;PWD=password;") ;到DSN里面配置了用户名密码则UID PWD不用配置。 ret := a.GetTable("select getdate()") MsgBox % ret.1.1 class adodb { ;static conn __New() ;新建 { this.conn:= ComObjCreate("ADODB.connection") ;初始化COM } open(connect_str) ;打开文件 { try this.conn.Open(connect_str) catch e return e.Message } close() ;关闭文件 { this.conn.Close() } GetTable(sql) { t := [] query := this.conn.Execute(sql) if RegExMatch(sql,"i)^select*") { try { fetchedArray := query.GetRows() ;取出数据(二维数组) colSize := fetchedArray.MaxIndex(1) + 1 ;列最大值 tips:从0开始 所以要+1 rowSize := fetchedArray.MaxIndex(2) + 1 ;行最大值 tips:从0开始 所以要+1 loop, % rowSize { i := (y := A_index) - 1 t[y] := [] loop, % colSize { j := (x := A_index) - 1 t[y][x] := fetchedArray[j,i] ;取出二维数组内值 } } } query.Close() return t } } }
65 queries in 1.650 seconds |
增大网 2019年2月13日 的 17:08
年后第一次来,恭喜恭喜!
7b 2019年1月4日 的 16:32
百度了很久没有结果,然后偶然看到这篇文章,虽然问题和文章那个没啥关系。。。。但是:请问AHK能把图片文件转换为Base64吗?