|
[code]
#include <array.au3>
#include <mysql.au3>
_MySQL_InitLibrary()
If @error Then Exit MsgBox(0, '', "")
$MysqlConn = _MySQL_Init()
$connected = _MySQL_Real_Connect($MysqlConn,"服务器IP","账户","密码","数据库名称")
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
$query = "select * from notice " ;SQL查询语句
_MySQL_Real_Query($MysqlConn, $query) ;进行SQL查询
$res = _MySQL_Store_Result($MysqlConn) ;获取查询结果的集合
$rows = _MySQL_Num_Rows($res) ;将查询结果的行数赋值
$fields = _MySQL_Num_Fields($res) 将查询结果的列数赋值
MsgBox(0, "查询行列数量", $rows & "-----" & $fields) ;显示查询结果的行列数量
;大哥们呀,我就毁在行赋值上面,正常应该显示是1行,但是在我的上网本上面显示是4294967296行
;真他妈的不知道是谁错了.系统重新安装过2个不同的,AU3版本也换过2个.台式机上运行没有问题,上网本就计算出错.
;郁闷呀,再也不敢用上网本学习了AU3了.
_MySQL_Free_Result($res)
; Verbindung beenden
_MySQL_Close($MysqlConn)
; MYSQL beenden
_MySQL_EndLibrary() |
|