找回密码
 加入
搜索
查看: 1431|回复: 5

求助!!!如何用AU3打开远古数据库文件??

[复制链接]
发表于 2009-3-28 19:41:43 | 显示全部楼层 |阅读模式
如何用AU3打开远古SQL2000数据库文件啊。。
哪位朋友能告诉一下?最好能有个范例。。。谢谢

在线等!

[ 本帖最后由 zdserver 于 2009-3-28 19:43 编辑 ]
发表于 2009-4-3 06:28:43 | 显示全部楼层
利用ado连接数据库.
发表于 2010-3-4 12:31:21 | 显示全部楼层
问题同楼主的   请大大们给以个列子
发表于 2010-3-4 13:31:15 | 显示全部楼层
#include-once
;===============================================================================
;
; Function Name:    _SQLConnect
; Description:      Initiate a connection to a SQL database
; Syntax:           $oConn = _SQLConnect($sServer, $sDatabase, $fAuthMode = 0, $sUsername = "", $sPassword = "", _
;                       $sDriver = "{SQL Server}")
; Parameter(s):     $sServer - The server your database is on
;                   $sDatabase - Database to connect to
;                   $fAuthMode - Authorization mode (0 = Windows Logon, 1 = SQL) (default = 0)
;                   $sUsername - The username to connect to the database with (default = "")
;                   $sPassword - The password to connect to the database with (default = "")
;                   $sDriver (optional) the ODBC driver to use (default = "{SQL Server}")
; Requirement(s):   Autoit 3 with COM support
; Return Value(s):  On success - returns the connection object for subsequent SQL calls
;                   On failure - returns 0 and sets @error:
;                       @error=1 - Error opening database connection
;                       @error=2 - ODBC driver not installed
;                       @error=3 - ODBC connection failed
; Author(s):        SEO and unknown
; Note(s):          None
;
;===============================================================================
Func _SQLConnect($sServer, $sDatabase, $fAuthMode = 0, $sUsername = "", $sPassword = "", $sDriver = "{SQL Server}")
    Local $sTemp = StringMid($sDriver, 2, StringLen($sDriver) - 2)
    Local $sKey = "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers", $sVal = RegRead($sKey, $sTemp)
    If @error or $sVal = "" Then Return SetError(2, 0, 0)
    $oConn = ObjCreate("ADODB.Connection")
    If NOT IsObj($oConn) Then Return SetError(3, 0, 0)
    If $fAuthMode Then $oConn.Open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";")
    If NOT $fAuthMode Then $oConn.Open("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase)
    If @error Then Return SetError(1, 0, 0)
    Return $oConn
EndFunc   ;==>_SQLConnect

;===============================================================================
;
; Function Name:    _SQLConnect
; Description:      Send a query to a SQL database and return the results as an object
; Syntax:           $oQuery = _SQLQuery($oConn, $sQuery)
; Parameter(s):     $oConn - A database connection object created by a previous call to _SQLConnect
;                   $sQuery - The SQL query string to be executed by the SQL server
; Requirement(s):   Autoit 3 with COM support
; Return Value(s):  On success - returns the query result as an object
;                   On failure - returns 0 and sets @error:
;                       @error=1 - Unable to process the query
; Author(s):        SEO and unknown
; Note(s):          None
;
;===============================================================================
Func _SQLQuery($oConn, $sQuery)
    If IsObj($oConn) Then Return $oConn.Execute($sQuery)
    Return SetError(1, 0, 0)
EndFunc ;==>_SQLQuery

;===============================================================================
;
; Function Name:    _SQLDisconnect
; Description:      Disconnect and close an existing connection to a SQL database
; Syntax:           _SQLDisconnect($oConn)
; Parameter(s):     $oConn - A database connection object created by a previous call to _SQLConnect
; Requirement(s):   Autoit 3 with COM support
; Return Value(s):  On success - returns 1 and closes the ODBC connection
;                   On failure - returns 0 and sets @error:
;                       @error=1 - Database connection object doesn't exist
; Author(s):        SEO and unknown
; Note(s):          None
;
;===============================================================================
Func _SQLDisconnect($oConn)
    If NOT IsObj($oConn) Then Return SetError(1, 0, 0)
    $oConn.Close
    Return 1
EndFunc   ;==>_SQLDisconnect
发表于 2010-12-2 18:21:02 | 显示全部楼层
这个是要在服务器端安装什么吗?举例说明一下吗?急啊
发表于 2010-12-3 10:33:00 | 显示全部楼层
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-2 22:28 , Processed in 0.081295 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表