Private Sub Command2_Click()
Dim Rs As New ADODB.Recordset
Dim Rac As New ADODB.Connection
Dim Sql As String
Sql="select * from Vendor"
Rac.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=WS_99_2002;Data Source=lyl"
Rs.Open Sql, Rac, adOpenStatic, adLockReadOnly
Set MSHFlexGrid1.DataSource = Rs
Set MSHFlexGrid1.DataSource = Nothing
Rs.Close
Rac.Close
Set Rs = Nothing
Set Rac = Nothing
End Sub
Private Sub Command3_Click()
Dim Rs2 As New ADODB.Recordset
Dim Rac As New ADODB.Connection
Dim Sql As String
Sql="select * from Customer"
Rac.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=WS_99_2002;Data Source=lyl"
Rs2.Open Sql, Rac, adOpenStatic, adLockReadOnly
Set MSHFlexGrid1.DataSource = Rs2
Set MSHFlexGrid1.DataSource = Nothing
Rs2.Close
Rac.Close
Set Rs2 = Nothing
Set Rac = Nothing
End Sub