Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to Linkage Database deletion by mshflexgrid

Shulou Source: shulou.com Published: 2022-06-01 13:55:31 09月26日 Update

Editor to share with you how mshflexgrid linkage database deletion, I hope you have something to gain after reading this article, let's discuss it together!

Application of Mshflexgrid attribute

MSHFlexGrid1.Row returns the currently selected line number

MSHFlexGrid1.TextMatrix (MSHFlexGrid1.Row, 0) represents the value of the first column that returns the specified row

Refresh thought after deletion

1. After the database is deleted, do the query again (not recommended, it consumes a lot of performance)

2. After the database is deleted, delete the specified row directly on the mshflexgrid and use the statement MSHFlexGrid1.RemoveItem MSHFlexGrid1.Row

You can delete the specified row by adding an index value after the RemoveItem method

File list:

Interface:

Source code:

Option ExplicitDim sql As StringDim conn As New ADODB.ConnectionDim rs As ADODB.Recordset

Private Sub Command1_Click () If conn.State = 0 Then conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\ Database3.mdb;Persist Security Info=False" conn.OpenEnd If

Sql = "insert into [users] ([username], [password]) values ('" & Text1.Text & ",'" & Text2.Text & "')"

Set rs = New ADODB.Recordset

Rs.Open sql, conn, adOpenKeyset, adLockBatchOptimistic'MsgBox "input successfully!"

Sql = "select * from users" rs.Open sql, conn, adOpenKeyset, adLockBatchOptimistic

Set MSHFlexGrid1.DataSource = rs

'header MSHFlexGrid1.TextMatrix (0,0) = "unique number" MSHFlexGrid1.TextMatrix (0,1) = "account" MSHFlexGrid1.TextMatrix (0,2) = "password"

End Sub

Private Sub Command2_Click () If conn.State = 0 Then conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\ Database3.mdb;Persist Security Info=False" conn.OpenEnd If

Set rs = New ADODB.Recordsetsql = "select * from users" rs.Open sql, conn, adOpenKeyset, adLockBatchOptimistic

Set MSHFlexGrid1.DataSource = rs

'header MSHFlexGrid1.TextMatrix (0,0) = "unique number" MSHFlexGrid1.TextMatrix (0,1) = "account" MSHFlexGrid1.TextMatrix (0,2) = "password" End Sub

Private Sub Command3_Click ()

If conn.State = 0 Then conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\ Database3.mdb;Persist Security Info=False" conn.OpenEnd If

Set rs = New ADODB.Recordset

Sql = "delete from [users] where [id] =" & MSHFlexGrid1.TextMatrix (MSHFlexGrid1.Row, 0)

Rs.Open sql, conn, adOpenKeyset, adLockBatchOptimistic

Method 1 of 'Call Command2_Click'

'method 2

MSHFlexGrid1.RemoveItem MSHFlexGrid1.Row

End Sub

After reading this article, I believe you have a certain understanding of "how mshflexgrid links database deletion". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for your reading!

Tags: Data database method password article header account success representative done attribute idea performance file more source code interface knowledge index industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Xiaomi Huawei Shulou Technology vpn