Dim CNN As New ADODB.Connection Dim STRSQL As String ' 打开 Private SubForm_Load() SubForm_Load()CNN.ConnectionString="Driver={MicrosoftVisualFoxProDriver};SourceType=DBF;SourceDb=E:DBF"CNN.OpenEndSub ' 创建 Private SubCommand1_Click() SubCommand1_Click()CNN.CursorLocation=adUseClientSTRSQL="CREATETABLEE:DBFDEMO.DBF([IDA]CHAR(32),[NAME]CHAR(32))"CNN.ExecuteSTRSQL'CNN.CloseEndSub ' 添加 Private SubCommand2_Click() SubCommand2_Click()STRSQL="insertintodemo([ida],[NAME])values('1','sdf')"CNN.ExecuteSTRSQLEndSub ' 显示 Private SubCommand3_Click() SubCommand3_Click()DimrsAsNewADODB.RecordsetSTRSQL="select*fromdemo"Setrs=CNN.Execute(STRSQL)IfNotrs.EOFThenText1.Text=rs.Fields(1)EndIfEndSub ' 修改 Private SubCommand4_Click() SubCommand4_Click()STRSQL="updatedemosetname='好好'whereida='1'"CNN.ExecuteSTRSQLEndSub