代码如下(手工编写):
'$Include "sqautil.sbh"
Sub Main
Dim Result As Integer
Dim connection As Long
Dim retcode As Variant
dim outputstr,query as string
Dim out(1 To 1,1 to 1) As Variant
'通过ODBC连接到javascript:;" onClick="javascript:tagshow(event, '%CA%FD%BE%DD%BF%E2');" target="_self">数据库,要先创建ODBC
connection = SQLOpen("DSN=server;UID=sa;PWD=998855", outputstr,)
'查询语句
query = "select password from customerinfo where userid=100"
'执行查询
retcode = SQLExecQuery(connection,query)
'取回结果,结果存入二维数组
retcode = SQLRetrieve(connection,out())
'取回结果,如果结果存入文件请使用
'retcode = SQLRetrieveToFile(connection,"c:\test.txt")
'显示结果
msgbox out(1,1)
'关闭数据库连接
retcode = SQLClose(connection)
End Sub
详细的命令用法,可以查阅Robot');" target="_self">Robot在线帮助。