Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to bind mshflexgrid data Table to Database

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to bind the mshflexgrid data table to the database. The content of the article is of high quality. Therefore, Xiaobian shares it with you as a reference. I hope you have a certain understanding of relevant knowledge after reading this article. mshflexgrid data table binding database

Where is ADODC?

Class Summary

1, master the use of adodc control methods to generate database connection strings

2. Before using the database, you must connect to the database conn.open. Use conn.state to determine whether to connect to the database. When the value is 0, it means no connection.

Note that memory space must be allocated before using the dataset rs

4. Before binding the query, you need to use sql statement to bind the data query to rs.

5. Use Set MSHFlexGrid1.DataSource = rs to bind the dataset to the mshflexgrid control

6. After it is displayed, that is, after binding, the header needs to be modified.

List of documents:

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 "Entry succeeded! "

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 Number"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 Number"MSHFlexGrid1.TextMatrix(0, 2) = "Password"End Sub About how to bind the database to mshflexgrid data table is shared here. I hope the above content can be of some help to everyone and learn more knowledge. If you think the article is good, you can share it so that more people can see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report