好吧.我也发一个关于MYSQL操作的 例子
本帖最后由 devil3380 于 2011-1-27 16:35 编辑#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=D:\ico\documents-white-exec.ico
#AutoIt3Wrapper_outfile=C:\Documents and Settings\Administrator\桌面\printf1.exe
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <array.au3>
#include "mysql.au3"
$Form1 = GUICreate("报表查询", 1000, 700, 0, 0)
$Button1 = GUICtrlCreateButton("职员档案", 80, 64, 81, 65)
$Button2 = GUICtrlCreateButton("订单列表", 80, 154, 81, 65)
GUISetState(@SW_SHOW)
While 1
$Msg = GUIGetMsg()
Select
Case $msg = $Button1
_MySQL_InitLibrary()
$MysqlConn = _MySQL_Init()
$connected = _MySQL_Real_Connect($MysqlConn, "localhost", "root", "_Memo", "oaerp_e2dx500i9erp1262745042");(,服务器名,ID,密码,数据库名)
If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn))
_mysql_set_character_set($MysqlConn,"GBK")
$query = "SELECT Name FROM HEmployee";需要查询的语句
_MySQL_Real_Query($MysqlConn, $query)
$res = _MySQL_Store_Result($MysqlConn)
$fields = _MySQL_Num_Fields($res)
$rows = _MySQL_Num_Rows($res)
Dim $array[$rows][$fields]
For $k = 1 To $rows
$mysqlrow = _MySQL_Fetch_Row($res,$fields)
$lenthsStruct = _MySQL_Fetch_Lengths($res)
For $i = 1 To $fields
$length = DllStructGetData($lenthsStruct, 1, $i)
$fieldPtr = DllStructGetData($mysqlrow, 1, $i)
$data = DllStructGetData(DllStructCreate("char[" & $length & "]", $fieldPtr), 1)
$array[$k - 1][$i - 1] = $data
Next
Next
_ArrayDisplay($array)
_MySQL_Data_Seek($res, 0)
_MySQL_Free_Result($res)
_MySQL_Close($MysqlConn)
_MySQL_EndLibrary()
Case $msg = $Button2
_MySQL_InitLibrary()
$MysqlConn = _MySQL_Init()
$connected = _MySQL_Real_Connect($MysqlConn, "localhost", "root", "_Memo", "oaerp_e2dx500i9erp1262745042");(,服务器名,ID,密码,数据库名)
If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn))
_mysql_set_character_set($MysqlConn,"GBK")
$query = "SELECT Name FROM tblsalecontr";需要查询的语句2
_MySQL_Real_Query($MysqlConn, $query)
$res = _MySQL_Store_Result($MysqlConn)
$fields = _MySQL_Num_Fields($res)
$rows = _MySQL_Num_Rows($res)
Dim $array[$rows][$fields]
For $k = 1 To $rows
$mysqlrow = _MySQL_Fetch_Row($res,$fields)
$lenthsStruct = _MySQL_Fetch_Lengths($res)
For $i = 1 To $fields
$length = DllStructGetData($lenthsStruct, 1, $i)
$fieldPtr = DllStructGetData($mysqlrow, 1, $i)
$data = DllStructGetData(DllStructCreate("char[" & $length & "]", $fieldPtr), 1)
$array[$k - 1][$i - 1] = $data
Next
Next
_ArrayDisplay($array)
_MySQL_Data_Seek($res, 0)
_MySQL_Free_Result($res)
_MySQL_Close($MysqlConn)
_MySQL_EndLibrary()
Case $msg = $GUI_EVENT_CLOSE
MsgBox(0, "注意", "正在退出...")
ExitLoop
EndSelect
WEnd昨天下了官方的UDF, 虽然有些是德文,但是连蒙带猜的 测试出来了,高手不要笑话哈
顺做了个界面
所需的都在附件中了 需要钱的啊 不行啊报错啊ERROR: _MySQL_InitLibrary(): undefined function.
_MySQL_InitLibrary() 回 2楼
官方的这个是 需要LIBMYSQL.dll 的
这个不是用ODBC连接的 你把这个文件放到同目录下 路过~~顶一下~~~~ 。。。。。。路过 回复 1# devil3380
我的看看货!呵呵! 回复 1# devil3380
测试运行需要什么环境啊?付了钱总是要得到点什么,呵呵! 回复devil3380
测试运行需要什么环境啊?付了钱总是要得到点什么,呵呵!
newuser 发表于 2010-6-7 15:32 http://www.autoitx.com/images/common/back.gif
需要你装了MQSQL数据库
需要LIBmysql.dll (这个可以在mysql的官网上可以下载) 不错哦 学习到手 要钱也没关系阿...需要用到 看看 好贵哦! 来看看怎么搞的 需要你装了MQSQL数据库
需要LIBmysql.dll (这个可以在mysql的官网上可以下载) 瞅瞅 正在找了