2个回答
展开全部
Private Sub Command1_Click(Index As Integer)
If List1.ListCount > 0 Then
For i = 0 To List1.ListCount - 1
rs.AddNew
RS.Fields("字段名称") = List1.List(i)
rs.Update
rs.MoveNext
Next i
End SUB
我没有调试,直接在百度里写的,你可以调试一下,如果出错,你把 rs.MoveNext放到循环外
If List1.ListCount > 0 Then
For i = 0 To List1.ListCount - 1
rs.AddNew
RS.Fields("字段名称") = List1.List(i)
rs.Update
rs.MoveNext
Next i
End SUB
我没有调试,直接在百度里写的,你可以调试一下,如果出错,你把 rs.MoveNext放到循环外
展开全部
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cmd As SqlCommand
Dim i As Integer
For i = 1 To ListBox1.Items.Count
cmd.CommandText = "insert into table (xxx)value('" & ListBox1.Items(i).ToString() & "')"
cmd.ExecuteNonQuery()
Next
End Sub
Dim cmd As SqlCommand
Dim i As Integer
For i = 1 To ListBox1.Items.Count
cmd.CommandText = "insert into table (xxx)value('" & ListBox1.Items(i).ToString() & "')"
cmd.ExecuteNonQuery()
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询