請問一下,為什麼這樣run出來後,資料會一直重覆產生
如:題號  選項(items)
1    a
  1    b
  2    a-----
  2    b-----ab會再跑出來
  2    c
  2    d  

  題號越多重覆越多

Dim cn As Object
  Dim rs As Recordset
  Set cn = CreateObject("ADODB.Connection")
 
  cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DB;Data Source=PDA-8NQU0C61ROS"
  Set rs = New ADODB.Recordset
  rs.Open Text_dbname.text, cn, adOpenStatic, adLockOptimistic
    

For Col = 0 To Text_questions - 1
   For Row = 0 To Val(Text_items.text) - 1
   rs.AddNew
   rs!Opsition = Combo_quest.ListIndex + 1
    
   rs!Items = MSFlexGrid1.TextMatrix(0, QuestIndex)
   rs!maxsel = MSFlexGrid1.TextMatrix(1, QuestIndex)
   rs!Random = MSFlexGrid1.TextMatrix(2, QuestIndex)
   rs!Txt = MSFlexGrid1.TextMatrix(3, QuestIndex)
   rs!Hint = MSFlexGrid1.TextMatrix(4, QuestIndex)
   rs!Jump = MSFlexGrid1.TextMatrix(5, QuestIndex)
              
    rs!Item = MSFlexGrid1.TextMatrix(Row + 6, Col)
    Combo_item.AddItem MSFlexGrid1.TextMatrix(Row + 6, QuestIndex)
            
   Next
 Next
  rs.Update
  rs.Close
  cn.Close
  Set cn = Nothing

MsgBox "成功建立一筆資料!"

    全站熱搜

    vbqa 發表在 痞客邦 留言(2) 人氣()