Home > Software engineering >  Consult MSHFlexGrid cascade results shown abnormal has a problem
Consult MSHFlexGrid cascade results shown abnormal has a problem

Time:10-02

I do the return data resulting from the SQL query in SHAPE, with MSHFlexGrid show, want to set the list head, in the following two cases, if there is any help, please explain, is there any way to solve, thank you!
(1) is in SHAPE of the query results, is actually two tables, do not go into a MSHFlexGrid together?
(2) a lower bound transfinite what reason be?
(3) when I use the string for the first query only set the header is ok, but more than the first table, the second table, can appear blank lines, again the second table columns, why??
The above is the main reason appeared in the SQL query, please appreciate your guidance, thank you!



'the code below
Option Explicit

'statement ADODB library. The Connection and the ADODB library. You object variables
Dim conn As ADODB. Connection
Dim the rs As New ADODB. You

Private Sub Command1_Click ()
Dim s As String
Dim As SQL String
'the instantiation Connection object
Set the conn=New ADODB. Connection
'set the connection provider name
Conn. The Provider="MSDataShape"
'set the connection string
Conn. The ConnectionString="Provider=MSDataShape; Data Source=D: \ Personal example SQL \ \ Desktop \ \ MSHFlexGrid VB hierarchy \ Nwind MDB. The Data Provider=Microsoft. Jet. The OLEDB. 4.0 "
'open to a data source connection
Conn. Open
'shape instructions
SQL="SHAPE {SELECT distinct orderID FROM the Orders} AS the Orders" + _
"APPEND ({the SELECT * FROM [the Order Details]} AS the detail" + _
"RELATE 'OrderID' TO 'OrderID') AS the detail"
'in the grading you object when the parent line location changes, the basic child records for reference is also changed,
Rs. StayInSync=True
'open the cursor
Rs. The Open SQL, conn
'set the MSHFlexGrid control data
The Set MSHFlexGrid1.
the DataSource=rs
'With MSHFlexGrid1
'TextMatrix (0, 1)="list head 1
"'TextMatrix (0, 5)="list in the first five"' error
'End With


S $="^ | ^ commodity name | | ^ specification unit | ^ ^" 'line will stay free
MSHFlexGrid1. FormatString=s $

Rs. Close
Set the rs=Nothing
Conn. Close
Set the conn=Nothing


End Sub


CodePudding user response:

The simplest method is an alias for each field in the SQL, do not have the column head,

CodePudding user response:

reference 1st floor Tiger_Zhao response:
the simplest method is an alias for each field in SQL, don't have the column head,


Slightly more complex way is to put the header says field note inside information, and then by reading the note to obtain information.
But the advantage is convenient to maintain in the future
  • Related