01 2012 档案
摘要:create proc sp_backupasdeclare @dbname varchar(20),@cmd1 nvarchar(120),@cmd2 varchar(120),@cmd3 varchar(120),@i int,@filename varchar(80),@path varchar(80)set @dbname='TEST'--\\这是数据库名,使用时只需要把它改成你所要备份的数据库名即可,这个必须修改\\------删除当前日期前15-前10天内的数据库备份,可根需要自行修改----set @i=10while @i<15 begin set @cm
阅读全文
摘要:将数据导入exceL中,不想再C#里直接计算,直接将查询总数量合并 直接返回SELECT e_salecode as b,count(e_quantity) as a FROM e_stockout where e_stockid in(3,4) and e_senddate='2012-01-12' group by e_salecodeunion all select 'Total Count', count(e_quantity) FROM e_stockout where e_stockid in(3,4) and e_senddate='201
阅读全文
摘要:select e_salecode as salecode ,count(e_quantity)as quantity from e_stockout where datediff(d,e_entertime,getdate())=0 and e_stockid =3 group by e_salecode执行后说从 char 数据类型到 datetime 数据类型的转换导致 datetime 值越界select e_salecode as salecode ,count(e_quantity)as quantity from e_stockout where datediff(d,con..
阅读全文
摘要:前台代码:View Code 1 <asp:GridView ID="GridView1" ShowFooter="true" runat="server" AutoGenerateColumns ="false" 2 style="border:solid 1px black" onrowdatabound="GridView1_RowDataBound">3 <Columns>4 <asp:BoundField DataField="
阅读全文
摘要:create proc [dbo].[sp_test1]as begin declare test cursor scroll for --声明游标select id,ordernumber from tb_order--给游标赋值open test --打开游标declare @id intdeclare @c varchar(100)while @@FETCH_STATUS=0 --利用@@FETCH_STATUS来循环begin fetch next from test into @id,@cinsert into tb_error(Message,TableNames)values(@
阅读全文
摘要:通常我们需要在每个页面判断Session是否存在,据此来断定用户是否登录,如果没有登录,就跳转到Login页面。如果每个页面都去写 if (Session["user"]==null) { Response.Redirect("login.aspx"); }下面介绍一种更简单的解决方案asp.net页面.cs文件都是继承System.Web.UI.Page,鼠标指向page然后转到定义,我们就会看到page里面所有的数据,.cs 类文件是只读的,我们无法修改,就只能新建一个类去继承page ,然后重写里面的一些方法,然后再让所有的页面继承这个类。先引用
阅读全文
摘要:/* 连接数 */select connectnum=count(distinct net_address)-1 from master..sysprocesses/* 返回一组有关计算机和有关 SQL Server 可用资源及其已占用资源的有用杂项信息 */select * from sys.dm_os_sys_info/* 从操作系统返回内存信息 */select * from sys.dm_os_sys_memory/* 返回有关调用进程的虚拟地址空间中的页范围的信息 */select * from sys.dm_os_virtual_address_dump/* 命令提供了SQL Se
阅读全文
摘要:waitfor 可以在指定的时间或者过了一定的时间段后执行语句块、存储过程或事务语法格式 :waitfor time '' 时间不能有日期部分waitfor time '10:04:54'print 'OK'
阅读全文
摘要:GOTO语句可以实现无条件跳转语法格式 GOTO lable 其中lable为要跳转到的语句标号遇到GOTO语句时直接跳转到lable标签处继续执行而goto之后的语句不再执行declare @result int=0declare @sn int =0loop_1:--定义标号set @result=@result+@snset @sn=@sn+1if(@sn<100)goto loop_1//如果小于100就跳转到loop_1标号处print @result
阅读全文