呵呵,你的scm.ExecuteNonQuery就在循环语句之中,每循环一次就插入一行,你应该将其挪到循环语句之外。
Dim Multi As String = "姓名,性别,年龄"
Dim Values() as String
Values = Multi.split(",")
dim y as String = ""
dim s as String = ""
For Index As Integer = 0 To Values.Length - 1
if e.Form.Controls(Values(Index)).Value = nothing
MessageBox.Show("对不起,您输入的信息不全,请录入<" & Values(Index) & ">后再继续!", "提示")
e.Form.Controls(Values(Index)).Select()
Return
end if
y = y & "," & Values(Index)
s = s & ",'" & e.Form.Controls(Values(Index)).value & "'"
Next
Dim scm as New SQLCommand
scm.ConnectionName = "y"
scm.CommandText = "Insert Into 民兵 " & "(" & y.Trim(",") & ")" & "" & "" & "Values(" & s.Trim(",") & ")"
scm.ExecuteNonQuery
大概就是这样,你自己调试一下吧
