Private Sub LoadData(ByVal jm As StringByVal)
Dim conn As New Connection
Dim temprs As New ADODB.Recordset
Dim strsql As String
Dim mocode As String
Dim cinvcode As String
Dim x As Integer
conn.Open Obj
填写代码处
strsql = "SELECT * from QWSK_SP_GongHao where cinvcode='" + cinvcode + "' "
With Adodc1
.ConnectionString = Obj
.RecordSource = strsql
End With
Adodc1.Refresh
Set temprs = Adodc1.Recordset
MSFlexGrid1.Cols = temprs.Fields.Count + 1
MSFlexGrid1.Rows = temprs.RecordCount + 1
'绑定数据
Dim j As Integer
For j = 0 To temprs.Fields.Count - 1
MSFlexGrid1.TextMatrix(0, j + 1) = temprs.Fields(j).Name '绑定表头列名称
Next j
If (temprs.EOF <> True And temprs.BOF <> True) Then
temprs.MoveFirst
End If
Dim i As Integer
i = 1
Do While True <> temprs.EOF
For j = 0 To temprs.Fields.Count - 1
MSFlexGrid1.TextMatrix(i, j + 1) = temprs.Fields(j).Value '绑定表体数据
Next j
i = i + 1
temprs.MoveNext
Loop
在填写代码处写上一句查询语句 使得strsql = "SELECT * from QWSK_SP_GongHao where cinvcode='" + cinvcode + "' "这句话cinvcode能用 cinvcode是当前行的字段