我用的是SQL 7,语言是VC.
我不是要自己手工找主键和删除那条记录,
是通过代码完成。比方说,一个函数什么的。

解决方案 »

  1.   

    距我所知,PowerBuilder里就有类似的函数,可以
    得到那个字段是否主键,及字段名。可CRecordset
    里没有这样的函数,GetODBCFieldInfo()办不到。
      

  2.   

    什么意思,guostong?
    不太明白。
      

  3.   

    sp_help table 
    SQL命令
      

  4.   

    啊,刚看了MSDN,不过怎么捕获结果到我的代码里?
    先谢谢Xia和guostong!
      

  5.   

    SQLPrimaryKeys()
    但我没用过,你只好自己试试了
      

  6.   

    晕菜,怎么是ODBCAPI?又是
    一堆句柄!
      

  7.   

    select * from sysobjects where xtype='PK' where Id=object_id('tablename')
      

  8.   

    wl1007:
    你的回答我试了一下,好像有点问题:
    Server: Msg 156, Level 15, State 1, Line 1
    Incorrect syntax near the keyword 'where'.
      

  9.   

    呵呵,我当然试了,
    结果是这种东西,看不出来……
    name        id          xtype uid    info   status      base_schema_ver replinfo    parent_obj  crdate                      ftcatid schema_ver  stats_schema_ver type userstat sysstat indexdel refdate                     version     deltrig     instrig     updtrig     seltrig     category    cache 
    --------------------------------------
    (0 row(s) affected)