用ADO连接上了数据源,怎样对数据源中的某一表的字段建立索引.在下段源码中如何建立呢?AConnection := CreateOleObject('ADODB.Connection');AConnection.Open('Provider=MSDASQL.1;Persist Security Info=False;Data Source=GisPipe');
{建立一个数据集对象并从数据表中提取数据}ARecordSet := CreateOleObject('ADODB.RecordSet');ARecordSet.open( 'pipevalue',AConnection,adOpenStatic,adLockOptimistic,adCmdTable );

解决方案 »

  1.   

    ARecordSet.CursorLocation:=adUseClient;
    ARecordSet.Sort:='字段1,字段2 desc';
      

  2.   

    ARecordSet.CursorLocation:=adUseClient;//到这的时候错误提示:对象打开时,操作不被允许,怎么办哟
      

  3.   

    ARecordSet := CreateOleObject('ADODB.RecordSet');
    ARecordSet.CursorLocation:=adUseClient;//缺省值,可不写
    ARecordSet.open('pipevalue',AConnection,adOpenStatic,adLockOptimistic,adCmdTable );
    ARecordSet.Sort:='字段1,字段2 desc';//用排序也一样