Dataenvironment與DataGeid的結合(編號:5696)

請問一下各位先進, 如果在程式中使用自訂的connection
來做DataEnvironment, 要把產生出來的command代入DataGrid
中並顯示出來, 以下的做法是否有誤? 因為一直無法顯示出
DataGrid的內容.(基本上DataGrid我在其屬性上並無其它設定
, 是一個空的DataGrid, 當程式產生出 DataEnvironment的Command
後才將其代入DataGrid)
程式內容如下 :
Private Sub cmdStart_Click()
mYear = Text1.Text   '學年
mSect = Combo1.Text   '學期
mClas = TDBCombo2.Text '班級
Text2.Text = mYear
Text3.Text = mSect
Text4.Text = mClas
Set cmda = New ADODB.Command
MySQL = "Transform SUM(學總) AS 學期總分 " & _
"SELECT 學號, 學年, 學期, 班級, 座號, 姓名 " & _
     "FROM scored_stud WHERE (學年 = " & Chr(39) & mYear & Chr(39) & _
     " AND 學期 = " & Chr(39) & mSect & Chr(39) & _
     " AND 班級 = " & Chr(39) & mClas & Chr(39) & ") " & _
     "GROUP BY 學號, 學年, 學期, 班級, 座號, 姓名 " & _
     "ORDER BY 學年, 學期, 班級, 座號 Pivot 科目"

Set cmda.ActiveConnection = DataEnvironment1.Connection1
cmda.CommandText = MySQL
cmda.Execute
If MsgBox("資料處理完成, 顯示資料嗎?", 4 + 64) = 6 Then
Set TDBGrid1.DataSource = DataEnvironment1
  TDBGrid1.DataMember = "cmda"
  TDBGrid1.Rebind
Else
Text1.Text = ""
  Combo1.Text = ""
  TDBCombo2.Text = ""
  TDBCombo3.Text = ""
End If
End Sub