展开全部
您好,很高兴为您解答。
#include
#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,"服务32313133353236313431303231363533e58685e5aeb931333337373732器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")
如若满意,请点击右侧【采纳答案】,如若还有问题,请点击【追问】
希望我的回答对您有所帮助,望采纳!
~ O(∩_∩)O~