#include <array.au3>
#include "mysql.au3"
Local $t1,$t2,$t3,$t4,$t5,$t6,$t7,$MysqlConn
$t1="0643A"
$t2='32423423423'
$t3="34324234434343"
$t4="342432434234"
$t5=@YEAR & "-" & @MON & "-" & @MDAY
$t6=@HOUR & ":" & @MIN & ":" & @SEC
$t7= "test"
_linksql()
_checkres()
_Write()
_EXIT()
Func _linksql()
__MySQL_ExtractEmbeddedDLL() ;
_MySQL_InitLibrary() ;
;================================================================
If @error Then Exit MsgBox(0, '', "");
MsgBox(0, "DLL Version:",_MySQL_Get_Client_Version()&@CRLF& _MySQL_Get_Client_Info());;================================================================
$MysqlConn = _MySQL_Init();
$connected = _MySQL_Real_Connect($MysqlConn, "192.168.41.27", "root", "123456", "OUTSIDE","3306")
;_MySQL_Query($connected, "set names 'GBK'")
;_Mysql_Set_Character_Set($MysqlConn,"GBK")
If $connected = 0 Then Exit MsgBox(16, 'Connection Error1', _MySQL_Error($MysqlConn))
EndFunc
Func _checkres()
$query = "SELECT * FROM test"
_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")
EndFunc
Func _Write()
;_MySQL_Query($MysqlConn, "set names utf8")
;_MySQL_Query($MysqlConn, "set names gb2312") INSERT DELAYED INTO
$line = "INSERT INTO "& $md &" (id1,id2,id3,id4,id5,id6) VALUES ('"& $t1 &"','" & $t2 & "', '" & $t3& "','" & $t4 & "','" & $t5 & "','" & $t6 & "')"
$A = _MySQL_Real_Query($MysqlConn, $line)
If $A = 0 And @error = 0 Then
MsgBox(0, "提示", "写入成功")
Else
MsgBox(16, "错误", "写入失败")
EndIf
;MsgBox(0,0,$a & "FFFF" & @error)
EndFunc
Func _EXIT()
;_MySQL_Free_Result($res);释放 查询纪录吧
_MySQL_Close($MysqlConn) ;关闭连线
_MySQL_EndLibrary() ;关闭 MYSQL (DLL)
Exit
EndFunc ;==>_EXIT