您好,很高兴为您解答。
#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~
$var = $oExcel.sheet(1).cells(1.1)//读取第一个单元格数据$oExcel.sheet(1).cells(2.1) = $var //把读取的值填进excel
$rowcount = ActiveSheet.UsedRange.Rows.Count //excel的行数
$Columnscount =ActiveSheet.UsedRange.Columns.Count //excel列数
----------------------------------------
核心就是这些,先读取excel的行数,然后循环读取每个单元格的值,就可以取得一列的值,然后按你的需要再赋值就行了
----------------------------------------
例如:
$ix = ActiveSheet.UsedRange.Rows.Count //把总行数读取进$ix
//这里定义一个可变的数组$row[],太久没用,忘了怎么写了...
For $i = 1 To $ix Step +1
$row[$i] = $oExcel.sheet(1).cells($i.1)//逐行读取第一列数据进数组中
//循环结束后就把第一列的数据读入数组$row了
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)