rs.open "select top 1 id from tablename order by id",cn,opentype

解决方案 »

  1.   

    INSERT INTO jobs (job_desc,min_lvl,max_lvl)
    VALUES ('Accountant',12,125)
    SELECT @@IDENTITY AS 'Identity'
      

  2.   


    INSERT INTO jobs (job_desc,min_lvl,max_lvl)
    VALUES ('Accountant',12,125)
    SELECT @@IDENTITY AS 'Identity'
      

  3.   

    插入完马上执行
    select @@identity
      

  4.   

    create table yourtable(id int identity (1,1),ad varchar(10))insert into yourtable (ad) select 'were'select ident_current('yourtable')  
                                             测试结果
    ---------------------------------------- 
    1(1 row(s) affected)