VB 6.0中使用msflexgrid控件,删除选中行的同时删除数据库的内容
PrivateSubCommand2_Click()Dimsql(0)AsStringWithMSFlexGrid1If.Rows=0Or.RowSel=0ThenExi...
Private Sub Command2_Click()
Dim sql(0) As String
With MSFlexGrid1
If .Rows = 0 Or .RowSel = 0 Then Exit Sub
rSel = .RowSel
If rSel <> .Rows - 1 Then
For i = rSel + 1 To .Rows - 1
For j = 1 To .Cols - 1
.TextMatrix(i - 1, j) = .TextMatrix(i, j)
Next
Next
End If
.Rows = .Rows - 1
End With
End Sub 展开
Dim sql(0) As String
With MSFlexGrid1
If .Rows = 0 Or .RowSel = 0 Then Exit Sub
rSel = .RowSel
If rSel <> .Rows - 1 Then
For i = rSel + 1 To .Rows - 1
For j = 1 To .Cols - 1
.TextMatrix(i - 1, j) = .TextMatrix(i, j)
Next
Next
End If
.Rows = .Rows - 1
End With
End Sub 展开
1个回答
展开全部
Private Sub Command1_Click()
Dim rSel As Long
With MSFlexGrid1
If .Rows = 0 Or .RowSel = 0 Then Exit Sub
rSel = .RowSel
If rSel <> .Rows - 1 Then
For i = rSel + 1 To .Rows - 1
For j = 1 To .Cols - 1
.TextMatrix(i - 1, j) = .TextMatrix(i, j)
Next
Next
End If
.Rows = .Rows - 1
End With
End Sub
Dim rSel As Long
With MSFlexGrid1
If .Rows = 0 Or .RowSel = 0 Then Exit Sub
rSel = .RowSel
If rSel <> .Rows - 1 Then
For i = rSel + 1 To .Rows - 1
For j = 1 To .Cols - 1
.TextMatrix(i - 1, j) = .TextMatrix(i, j)
Next
Next
End If
.Rows = .Rows - 1
End With
End Sub
追问
这个目前只能删除当前msflexgrid的行内容,无法删除Access数据库中的内容。如何实现删除选中行的同时删除数据库的内容。
sql(0) = "delete from date where ID ="
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询