启航-▲每天有个新的开始▲  
string sql = "insert into [table] values()SELECT   SCOPE_IDENTITY()";
cmd.CommandText = strSql;
    cmd.Connection = cn;
    cn.Open();
    OleDbDataReader oleread = cmd.ExecuteReader();
    if(oleread.Read())
    {
     id = int.Parse(oleread[0].ToString());
    }
    oleread.Close();
    cn.Close();

重致自增种子:
要么使用truncate   table或者DBCC   CHECKIDENT   (你的表名,   RESEED,   1)来重致自增种子
posted on 2007-10-08 18:50  bighope  阅读(169)  评论(1编辑  收藏  举报