回复 2# sbtddh
没用过Hsql
但我想原理应该都差不多:
我贴一下连MYsql的样式等你参考一下:Func _MySQLConnect($sUsername, $sPassword, $sDatabase, $sServer, $sDriver = "{MySQL ODBC 5.2w Driver}", $iPort=3306)
Local $v = StringMid($sDriver, 2, StringLen($sDriver) - 2)
Local $key = "HKLM\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers", $val = RegRead($key, $v)
If @error or $val = "" Then
SetError(2)
TrayTip ("Message","连接失败,没有找到驱动",30)
Sleep(1000)
Return 0
EndIf
$ObjConn = ObjCreate("ADODB.Connection")
$Objconn.open ("DRIVER=" & $sDriver & ";SERVER=" & $sServer & ";DATABASE=" & $sDatabase & ";UID=" & $sUsername & ";PWD=" & $sPassword & ";PORT="&$iPort)
If @error Then
SetError(1)
TrayTip ("Message","连接失败",30)
Sleep(1000)
Return 0
Else
TrayTip ("Message","连接成功",30)
Sleep(1000)
Return $ObjConn
EndIf
EndFunc ;==>_MySQLConnect
|