|
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <mysql.au3>
#include <array.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 447, 192, 124)
$ListView1 = GUICtrlCreateListView("姓名|联系电话|传真|EMAIL|地址|单位|反馈内容|时间", 8, 16, 609, 353)
$Button1 = GUICtrlCreateButton("读取反馈", 240, 392, 129, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
_MySQL_InitLibrary()
If @error Then Exit MsgBox(0, '', "")
$MysqlConn = _MySQL_Init()
$connected = _MySQL_Real_Connect($MysqlConn, "0.0.0.0", "aaa", "sss3", "zsq1d1_db")
If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn))
$query = 'SELECT name, contactPhone, contactFax, contactEmail, address, company feedBackContent, feedBackContent FROM feedback ORDER BY feedBackID';DESC"
_MySQL_Real_Query($MysqlConn, $query)
$res = _MySQL_Store_Result($MysqlConn)
$fields = _MySQL_Num_Fields($res)
$rows = _MySQL_Num_Rows($res)
$array = _MySQL_Fetch_Result_StringArray($res)
_ArrayDisplay($array)
; fieldinfomation
MsgBox(0, '', "Access fieldinformation")
Dim $arFields[$fields][3]
For $i = 0 To $fields - 1
$field = _MySQL_Fetch_Field_Direct($res, $i)
$arFields[$i][0] = _MySQL_Field_ReadValue($field, "name")
$arFields[$i][1] = _MySQL_Field_ReadValue($field, "contactPhone")
$arFields[$i][2] = _MySQL_Field_ReadValue($field, "contactFax")
$arFields[$i][3] = _MySQL_Field_ReadValue($field, "contactEmail")
$arFields[$i][4] = _MySQL_Field_ReadValue($field, "address")
$arFields[$i][5] = _MySQL_Field_ReadValue($field, "company feedBackContent")
$arFields[$i][6] = _MySQL_Field_ReadValue($field, "feedBackContent")
Next
MsgBox(0,"","")
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
今天刚刚接触MYSQL的UDF 不是很会用啊
上面代码运行后就没什么提示自动退出了
帮忙给看一下 |
|