数据库原有ID字段,是自增列的,后来把数据全删除后,想让ID自增列从1开始算起

方法1:


1.dbcc checkident('test',reseed,0)
2.insert into test values(55)

select *  from test

显示结果:

id      msum

1        55

方法2:

SET IDENTITY_Insert 

允许将显式值插入表的标识列中。

语法:
SET IDENTITY_Insert [ database_name . [ schema_name ] . ] table { ON | OFF }
set identity_insert dbo.test on
test是表名
注意:运用set identity_insert dbo.test on后,insert into时,必须要把需要插入记录的字段写上,如:
insert into test(id,msum)values(1,55)
insert into test(id,msum)values(2,55)
下面的语句的写法是错误的:
insert into test values(55)
insert into test values(1,55)
posted @ 2007-12-19 18:33 Fernando 阅读(675) 评论(0) 编辑

前一阵做一个项目,在处理报表的时候时间偏长,客户提出要做出一个等待窗口提示用户等待(页面太久没反映,用户还以为死了呢)。在分析这一需求之后,觉得如果要实现像winform应用中的processbar太困难了。最后,只好模拟,做了一个“假”的等待窗体,还好客户也挺满意。

这个等待窗体实际上是利用了<object>标签完成的。因为动态效果由<marquee>完成,该等待窗体显示出来的时候,整个table是透明的,只有中间的过程条在动,后面的任何按钮都不能点击。

首先做一个静态页面:downloadExcel.html

报表生成中,请稍等...
 
               
 

然后在处理画面中加上这么一段:

<TABLE border="0" id="processBarMask" bgcolor="#cccccc" style="VISIBILITY:hidden; POSITION: absolute" cellspacing="0" cellpadding="0">
    <TR>
        <TD align="center">
        <object type="text/x-scriptlet" id="objProcessBar" style="z-index:65535;" width="302" height="102" data="downloadExcel.html"></object>
        </TD>
    </TR>
</TABLE>

一开始是隐藏起来的。当点击处理按钮之后,就将它显示出来:

<SCRIPT language="javaScript">
    var firstFlg = "0";

    function processStart(){
          with(document.all.processBarMask.style){
                 top = 0;
                 width = "100%";
                 height = "100%";
                 visibility = "visible";
          }
          document.all.processBarMask.focus();
    }

    function processEnd(){
        document.all.processBarMask.style.visibility = "hidden";
    }
</SCRIPT>

最后给处理按钮加上处理:

 <input type="button" id="btnOK" value="OK" onclick="processStart()" style="width:80px">

posted @ 2007-12-19 12:52 Fernando 阅读(911) 评论(1) 编辑
NorthwindDataSetTableAdapters.CustomersTableAdapter tableAdapter =
    new NorthwindDataSetTableAdapters.CustomersTableAdapter();

int returnValue = (int)tableAdapter.GetCustomerCount();
posted @ 2007-12-19 10:46 Fernando 阅读(64) 评论(0) 编辑