您好,很高兴为您解答。
#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")
如若满意,请点击右侧【采纳答案】,如若还有问题,请点击【追问】
希望我的回答对您有所帮助,望采纳!
~ O(∩_∩)O~
Dim $hardware = "cur_user"$conn = ObjCreate("ADODB.Connection")
$RS = ObjCreate("ADODB.Recordset")
$conn.Open("driver={SQL Server}server=192.168.0.254uid=netcafepwd=pubwindatabase=local")
$RS.ActiveConnection = $conn
$RS.open("SELECT * FROM cur_user")
While (Not $RS.eof And Not $RS.bof)
msgbox .......................................
EndIf
$RS.movenext
WEnd
$RS.close
在autoit论坛上看到的。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)