zdserver 发表于 2009-3-28 19:41:43

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

如何用AU3打开远古SQL2000数据库文件啊。。
哪位朋友能告诉一下?最好能有个范例。。。谢谢

在线等!

[ 本帖最后由 zdserver 于 2009-3-28 19:43 编辑 ]

bing614 发表于 2009-4-3 06:28:43

利用ado连接数据库.

zmj2008 发表于 2010-3-4 12:31:21

问题同楼主的   请大大们给以个列子

ghostystep 发表于 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

My2009 发表于 2010-12-2 18:21:02

这个是要在服务器端安装什么吗?举例说明一下吗?急啊

boyhong 发表于 2010-12-3 10:33:00

论坛搜索:http://www.autoitx.com/search.php?searchid=62&orderby=lastpost&ascdesc=desc&searchsubmit=yes
页: [1]
查看完整版本: 求助!!!如何用AU3打开远古数据库文件??