#include <array.au3>
#include "mysql.au3"
__MySQL_ExtractEmbeddedDLL()
_MySQL_InitLibrary()
$MysqlConn = _MySQL_Init()
;方法1 开始
;$connected = _MySQL_Real_Connect($MysqlConn,"localhost","root","asdf1234","gmsj")
;If $connected = 0 Then
; $errno = _MySQL_errno($MysqlConn)
; MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn))
; If $errno = $CR_UNKNOWN_HOST Then MsgBox(0,"Error:","$CR_UNKNOWN_HOST" & @LF & $CR_UNKNOWN_HOST)
;Endif
;MsgBox(0, "sda", "ok")
;方法1 结束
$connected = _MySQL_Real_Connect($MysqlConn, "127.0.0.1", "root", "sssss", "data")
; _MySQL_Real_Connect($MysqlConn,"服务器IP","账户","密码","数据库名称")
If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn))
$query = "SELECT * FROM CHARACTER_SETS"
_MySQL_Real_Query($MysqlConn, $query)
$res = _MySQL_Store_Result($MysqlConn)
$fields = _MySQL_Num_Fields($res)
$rows = _MySQL_Num_Rows($res)
MsgBox(0, "data","row:"&$rows & "-" & $fields&"ok")
|