func peizhi()
_SQLite_Startup ()
$hQuery=_SQLite_Open ($SQLite_Data_Path)
_SQLite_Query(-1,"select * from peizhi where id='2';",$hQuery)
if _SQLite_FetchData($hQuery, $peizhi) = $SQLITE_OK Then
$zhangjie=StringSplit($peizhi[1],"|")
_SQLite_Close($hQuery)
_SQLite_Shutdown()
If @error=1 Then ;判断是否读到间隔符,如果读不到安单章处理,读到进行选择试题
Switch $peizhi[1]
Case 0
GUICtrlSetState($all,$GUI_CHECKED)
GUICtrlSetState($all,$GUI_DISABLE)
GUICtrlSetState($now,$GUI_DISABLE)
case Else
GUICtrlSetState($now,$GUI_CHECKED)
GUICtrlSetState($now,$GUI_DISABLE)
GUICtrlSetState($all,$GUI_DISABLE)
EndSwitch
Else
GUICtrlSetState($now,$GUI_CHECKED)
GUICtrlSetState($now,$GUI_DISABLE)
GUICtrlSetState($all,$GUI_DISABLE)
$zhangjietimu=StringSplit($peizhi[3],"|")
If $zhangjie[0] <>$zhangjietimu[0] Then MsgBox(0,"提醒","查看配置文件,章节设置和题目设置不一致")
Local $ii ;
For $ii=1 To $zhangjie[0]
Local $sql
_SQLite_Startup ()
$hQuery=_SQLite_Open ($SQLite_Data_Path)
$sql="select * from Testmod where IDs="&$peizhi[1]&";"
; MsgBox(0,"配置读取",$sql) ;测试是否正确读取到模块
_SQLite_Query(-1,$sql,$hQuery)
if _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK Then
MsgBox(0,"总数2",$aRow[1]&$aRow[2])
$zshu=$aRow[2]
$mokuai=$aRow[1]
EndIf ;模块读取结束得到试题总数和模块名称 为后面选择提供方便
_SQLite_Close($hQuery)
_SQLite_Shutdown()
Local $iii,$jjj,$ti
for $iii=1 to $zshu ;初始化一个所有题目的数字,为生成试题数组做准备
;MsgBox(0,"s",$i)
$ti[$iii]=$iii
Next ;$iii
for $jjj=0 to $zhangjietimu[$ii] ;开始生成试题数组,
$tmp=Random(1,$zshu-$jjj,1); 得到数后将得到的下标的序号由ti数组末尾进行填充。
$timu[$jjj]=$ti[$tmp]
$ti[$tmp]=$ti[$zshu-$jjj]
$sql="select * from "&$mokuai&" where id="&$timu[0]&";"
_SQLite_Startup ()
$hQuery=_SQLite_Open ($SQLite_Data_Path)
_SQLite_Query(-1,$sql,$hQuery)
if _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK Then
Local $tmpsql
$tmpsql="INSERT INTO temp VALUES ("&$aRow[0]&","&$aRow[1]&","&$aRow[2]&","&$aRow[3]&","&$aRow[4]&","&""&","&$aRow[6]&")"
_SQLite_Exec (-1, $tmpsql)
EndIf
Next ;$jjj
Next ;$ii
EndIf ;判断结束
Else
MsgBox(0,"读数据库错!","程序即将退出!")
exit
EndIf
EndFunc