; Find the \"reference\" of Microso" />

How does datagrid control in vb increase the number of columns?

The number of columns is automatic, that is, the number of fields in the recordset.

Ctrl+t find Microsoft DataGrid control ....

Menu "project"->; Find the "reference" of Microsoft ActiveX data objects ....

Dim cn as the new ADODB. relationship

Dim rst as the new ADODB. Record set

Mark SqlStr as a string

cn。 Open "Provider=Microsoft。 Jet. OLEDB.4.0 data source = "&app. Path and path. " \ db 1 . MDB; Mode = read and write; Persist security information = FalseJet OLEDB: database password = 1 1 1 "

SqlStr = "Select * From a table "

rst。 CursorLocation = adUseClient

Rst。 Opensqlstr, cn, adopen dynamic, adlockoptimal, adcmdtext' opens recordset.

Set datagrid 1. "datasource = rst" modifies the data source of datagrid65438.