Private Sub Fgrid1_DblClick()
If Fgrid1.Col = 3 Then
Select Case Fgrid1.Row
Case 1
If Fgrid1.Text = "" Then
Fgrid1.Text = "参选"
s(1) = "151"
x = x + 1
Else
Fgrid1.Text = ""
s(1) = ""
x = x - 1
End If
Case 2
If Fgrid1.Text = "" Then
Fgrid1.Text = "参选"
s(2) = "152"
x = x + 1
Else
Fgrid1.Text = ""
s(2) = ""
x = x - 1
End If
Case 3
If Fgrid1.Text = "" Then
Fgrid1.Text = "参选"
s(3) = "121"
x = x + 1
Else
Fgrid1.Text = ""
s(3) = ""
x = x - 1
End If
Case 4
If Fgrid1.Text = "" Then
Fgrid1.Text = "参选"
s(4) = "122"
x = x + 1
Else
Fgrid1.Text = ""
s(4) = ""
x = x - 1
End If
End Select
StatusBar1.Panels.Item(1) = "参选班级:027" & s(1) & " " & s(2) & " " & s(3) & " " & s(4)
End If
End Sub
Private Sub MSFlexGrid1_DblClick(Index As Integer)
Select Case Index
Case 0
I = MSFlexGrid1(2).Rows
If MSFlexGrid1(0).row = 0 Then Exit Sub
If Trim(MSFlexGrid1(0).TextArray(MSFlexGrid1(0).Cols * MSFlexGrid1(0).row + 1)) = "" Then Exit Sub
MSFlexGrid1(2).Rows = I + 1
MSFlexGrid1(2).TextArray(I * 3 + 0) = "-"
MSFlexGrid1(2).TextArray(I * 3 + 1) = MSFlexGrid1(0).TextArray(MSFlexGrid1(0).Cols * MSFlexGrid1(0).row + 1)
MSFlexGrid1(2).TextArray(I * 3 + 2) = MSFlexGrid1(0).TextArray(MSFlexGrid1(0).Cols * MSFlexGrid1(0).row + 2)
Frame1(2).Caption = "准备加"
Frame1(2).ForeColor = &H8000&
Case 1
I = MSFlexGrid1(2).Rows
If MSFlexGrid1(1).row = 0 Then Exit Sub
If Trim(MSFlexGrid1(1).TextArray(MSFlexGrid1(1).Cols * MSFlexGrid1(1).row + 1)) = "" Then Exit Sub
MSFlexGrid1(2).Rows = I + 1
MSFlexGrid1(2).TextArray(I * 3 + 0) = "-"
MSFlexGrid1(2).TextArray(I * 3 + 1) = MSFlexGrid1(1).TextArray(MSFlexGrid1(1).Cols * MSFlexGrid1(1).row + 1)
MSFlexGrid1(2).TextArray(I * 3 + 2) = MSFlexGrid1(1).TextArray(MSFlexGrid1(1).Cols * MSFlexGrid1(1).row + 2)
Frame1(2).Caption = "准备取消"
Frame1(2).ForeColor = &HFF&
Case 2
j = MSFlexGrid1(2).Rows
k = MSFlexGrid1(2).row
If Trim(MSFlexGrid1(1).TextArray(MSFlexGrid1(2).Cols * MSFlexGrid1(2).row + 1)) = "" Then Exit Sub
If k = 0 Then Exit Sub
For jFor = k * 3 To (j - 1) * 3 - 1
MSFlexGrid1(2).TextArray(jFor) = MSFlexGrid1(2).TextArray(jFor + 3)
Next jFor
MSFlexGrid1(2).Rows = j - 1
写的很匆忙,可能会有些问题,有问题给我留言。大概的意思就是这样的
Dim mysql As String
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim con As New ADODB.Connection
Dim strcon As String
Private Sub Command1_Click()
With rs2
.AddNew
.Fields(0).Value = rs1.Fields(0).Value
.Fields(1).Value = rs1.Fields(1).Value
.Fields(2).Value = rs1.Fields(2).Value
.Fields(3).Value = rs1.Fields(3).Value
.Update
End With
With rs1
.Delete adAffectCurrent
.Update
End With
Me.Grid1.DataSource = rs1
Me.Grid1.DataSource = rs2
End Sub