''双击一行删除
Private Sub MSFlexGrid1_DBClick()
MSFlexGrid1.RemoveItem MSFlexGrid1.row
End Sub
''删除数据库中的相应记录
' 为使用TextArray 属性计算索引。
Function faIndex(row As Integer, col As Integer) As Long
faIndex =row * MSHFlexGrid1.Cols + col
End Function
'用ado
Private Sub delDAta()
dim Dbaseid as string
''假设左边第一列为该表的主键
Dbaseid=MSHFlexGrid1.TextArray(faIndex(MSHFlexGrid1.row, 1))
Set Rec = New ADODB.Recordset
Set Rec.ActiveConnection = Conn 'conn为一连接数据库的connection
Rec.CursorType = adOpenKeyset
Rec.LockType = adLockOptimistic
Rec.Open "select from datebase where databaseId="&"'"& Sbaseid &"'"
if Rec.recordcount=1 then
Rec.delete
end if
rec.close