使用Autohotkey连接到Microsoft SQL Server吗?

时间:2019-07-11 14:51:12

标签: sql-server autohotkey

我每天运行一个ahk脚本,但是首先,我必须在运行查询后将数据硬编码到其中。是否可以通过Autohotkey连接到SQL Server?这显然是理想的。我读过几篇文章,但到目前为止还没有成功。

我没有运气尝试过下面的示例逻辑。

谢谢!

ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=user;Password=pw;Initial Catalog=db;Data Source=server;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Use Encryption for Data=False;Tag with column collation when possible=False"
Query := "select * from tbl"
Table := ADOSQL(ConnectionString, Query)
Loop % Table.MaxIndex() - 1 ; We subtract 1 in order to skip one row (which will be the column titles, as we are adding 1 to the counter below).
{
     CURRENT_ROW := A_Index + 1 ; We add one to our current row counter in order to start on row 2 (skip row 1).
     Loop % Table[CURRENT_ROW].MaxIndex()
     {
          CURRENT_COLUMN := A_Index
          msgbox % Table[CURRENT_ROW, CURRENT_COLUMN]
     }
}

0 个答案:

没有答案