大侠,帮忙,关于Robot和Access
通过SQAGetProperty 方法截取下来的数据,可以写入我事先建立好的Access表中吗?有没有这方面的例子,可以公布下吗?谢谢大家了。[ Last edited by ilovejolly on 2005-9-1 at 14:12 ] 这个是对excel操作的脚本!
Sub Main
Dim myString as String
Dim sFilename as String
Dim Result As Integer
Result = SQAGetProperty("Type=Label;ObjectIndex=1","Text",myString)
--- 这里截取的是一个弹出窗口的提示信息
sFilename = "C:\test.xls"
Open sFilename For Output As #1
Print #1, myString
Close #1
End Sub
[ Last edited by ilovejolly on 2005-9-1 at 11:23 ] 不是版主,我要插入时间建立好的Access数据表中?可以吗?
然后我还要判断插入的数据在表中是否存在,怎么搞阿?请帮帮忙 看错了,不好意思
Sub main
Dim connection As Long
Dim retcode As long
Dim outputStr as String
Dim query as String
Dim result as integer
Result = SQAGetProperty("Type=Label;ObjectIndex=1","Text",myString)
connection = SQLOpen("DSN=Test",outputStr,prompt:=3)
query = "insert into table(row) values(mystring)"
retcode = SQLExecQuery(connection,query)
retcode = SQLClose(connection)
End Sub
DNS在控制面板管理工具DataSource里配制
我把你说的判断插入数据是否存在理解为不让插入重复的,那么你只用在access里对列做主健或无重复索引设置。在脚本写数据的地方加上判断,就可以了。具体怎么做,方法很多。
如果要在脚本里做,在插入数据前去比照数据表的数据判断,用循环,感觉效率太低,没什么必要
[ Last edited by ilovejolly on 2005-9-1 at 11:27 ] 谢谢版主~~~~~~~~~
“prompt:=3”
想问一下斑竹,这里的prompt:=3在这里有什么含义吗?是否能改为prompt:=2或prompt:=4等等呢?谢谢指教 1Driver dialog is always displayed.
2
Driver dialog is displayed only when the specification is not sufficient to make the connection.
3
The same as 2, except that dialogs that are not required are grayed and cannot be modified.
4
Driver dialog is not displayed. If the connection is not successful, an error is returned.
When prompt is omitted, SQLOpen uses 2 as the default.
其实这些help里面有,而且自己动手一试便知! 恩,明了,非常感谢
页:
[1]