zoukankan      html  css  js  c++  java
  • 获得自增列

                        cmd.CommandText="SELECT     COLUMNPROPERTY(     OBJECT_ID('"+_TableName+"'), '"+col.Name+"', 'IsIdentity' )   ";
                        reader= cmd.ExecuteReader();
                        i = 0;
                        if (reader.Read()) i = reader.GetInt32(0);
                        reader.Close();
                        if (i==1)
                        {
                            col.isAutoIncrease = true;
                            cmd.CommandText = "select   IDENT_SEED( '" + _TableName + "')  as  seedvalue,IDENT_INCR   (   '" + _TableName + "'   )   as increvalue  ";
                            reader = cmd.ExecuteReader();
                            if (reader.Read())
                            {
                                    col.AutoIncrementSeed =Convert.ToInt32( reader.GetValue(0));
                                    col.AutoIncrementStep =Convert.ToInt32( reader.GetValue(1));
                            }
                            reader.Close();
                        }

  • 相关阅读:
    hibernate对应的annocation版本
    Struts 2 OGNL
    Struts2的Stack Context和ValueStack
    Struts2中的OGNL详解
    struts2中根对象以及ognl .
    在Struts 2中实现IoC
    Struts2的属性驱动与模型驱动的区别
    Struts2的模型驱动
    Java中线程的锁和数据库中的事务隔离级别
    为什么socket编程要用到多线程
  • 原文地址:https://www.cnblogs.com/CodeBlove/p/1371517.html
Copyright © 2011-2022 走看看