杂乱知识点

    技术2022-05-11  77

    安装Media player 11 和IE7有什么办法得到正版的认证

    把下面这段代码复制到记事本里,保存为key.vbs,双击打开就可以了 ON ERROR RESUME NEXT Dim VOL_PROD_KEY if Wscript.arguments.count<1 then VOL_PROD_KEY=InputBox("Powered By www.cnbeta.com"&vbCr&vbCr&" 本程序将自动替换你当前 Windows 的序列号,通过微软验证完全正版。"&vbCr&vbCr&"序列号(OEM版无效,默认版本为 XP VLK):","Windows XP序列号自动更换器","MRX3F-47B9T-2487J-KWKMF-RPWBY") if VOL_PROD_KEY="" then Wscript.quit end if else VOL_PROD_KEY = Wscript.arguments.Item(0) end if VOL_PROD_KEY = Replace(VOL_PROD_KEY,"-","") 'remove hyphens if any for each Obj in GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("win32_WindowsProductActivation") result = Obj.SetProductKey (VOL_PROD_KEY) if err = 0 then Wscript.echo "OK!去微软验证吧!" end if if err <> 0 then Wscript.echo "替换失败!输入的 CD-KEY 与当前的版本不匹配。" Err.Clear end if Next 12月17日 20:47 | 添加评论  | 固定链接  | 引用通告 (0)  | 写入日志

    放假回来

    放假刚回来,一切还是那样的平常.好开心

    10月6日 8:04 | 添加评论  | 固定链接  | 引用通告 (0)  | 写入日志

    征集佳句-精妙SQL语句收集

    SQL语句先前写的时候,很容易把一些特殊的用法忘记,我特此整理了一下SQL语句操作,方便自己写SQL时方便一点,想贴上来,一起看看,同时希望大家能共同多多提意见,也给我留一些更好的佳句,整理一份《精妙SQL速查手册》,不吝赐教! 一、基础 1、说明:创建数据库 CREATE DATABASE database-name 2、说明:删除数据库 drop database dbname 3、说明:备份sql server --- 创建 备份数据的 device USE master EXEC sp_addumpdevice 'disk', 'testBack', 'c:/mssql7backup/MyNwind_1.dat' --- 开始 备份 BACKUP DATABASE pubs TO testBack 4、说明:创建新表 create table tabname(col1 type1 [not null] [primary key],col2 type2 [not null],..) 根据已有的表创建新表: A:create table tab_new like tab_old (使用旧表创建新表) B:create table tab_new as select col1,col2… from tab_old definition only 5、说明:删除新表 drop table tabname 6、说明:增加一个列 Alter table tabname add column col type 注:列增加后将不能删除。DB2中列加上后数据类型也不能改变,唯一能改变的是增加varchar类型的长度。 7、说明:添加主键: Alter table tabname add primary key(col) 说明:删除主键: Alter table tabname drop primary key(col) 8、说明:创建索引:create [unique] index idxname on tabname(col….) 删除索引:drop index idxname 注:索引是不可更改的,想更改必须删除重新建。 9、说明:创建视图:create view viewname as select statement 删除视图:drop view viewname 10、说明:几个简单的基本的sql语句 选择:select * from table1 where 范围 插入:insert into table1(field1,field2) values(value1,value2) 删除:delete from table1 where 范围 更新:update table1 set field1=value1 where 范围 查找:select * from table1 where field1 like ’%value1%’ ---like的语法很精妙,查资料! 排序:select * from table1 order by field1,field2 [desc] 总数:select count as totalcount from table1 求和:select sum(field1) as sumvalue from table1 平均:select avg(field1) as avgvalue from table1 最大:select max(field1) as maxvalue from table1 最小:select min(field1) as minvalue from table1 11、说明:几个高级查询运算词 A: UNION 运算符 UNION 运算符通过组合其他两个结果表(例如 TABLE1 和 TABLE2)并消去表中任何重复行而派生出一个结果表。当 ALL 随 UNION 一起使用时(即 UNION ALL),不消除重复行。两种情况下,派生表的每一行不是来自 TABLE1 就是来自 TABLE2。 B: EXCEPT 运算符 EXCEPT 运算符通过包括所有在 TABLE1 中但不在 TABLE2 中的行并消除所有重复行而派生出一个结果表。当 ALL 随 EXCEPT 一起使用时 (EXCEPT ALL),不消除重复行。 C: INTERSECT 运算符 INTERSECT 运算符通过只包括 TABLE1 和 TABLE2 中都有的行并消除所有重复行而派生出一个结果表。当 ALL 随 INTERSECT 一起使用时 (INTERSECT ALL),不消除重复行。 注:使用运算词的几个查询结果行必须是一致的。 12、说明:使用外连接 A、left outer join: 左外连接(左连接):结果集几包括连接表的匹配行,也包括左连接表的所有行。 SQL: select a.a, a.b, a.c, b.c, b.d, b.f from a LEFT OUT JOIN b ON a.a = b.c B:right outer join: 右外连接(右连接):结果集既包括连接表的匹配连接行,也包括右连接表的所有行。 C:full outer join: 全外连接:不仅包括符号连接表的匹配行,还包括两个连接表中的所有记录。 二、提升 1、说明:复制表(只复制结构,源表名:a 新表名:b) (Access可用) 法一:select * into b from a where 1<>1 法二:select top 0 * into b from a

    2、说明:拷贝表(拷贝数据,源表名:a 目标表名:b) (Access可用)insert into b(a, b, c) select d,e,f from b;

    3、说明:跨数据库之间表的拷贝(具体数据使用绝对路径) (Access可用)insert into b(a, b, c) select d,e,f from b in ‘具体数据库’ where 条件例子:..from b in '"&Server.MapPath(".")&"/data.mdb" &"' where..

    4、说明:子查询(表名1:a 表名2:b)select a,b,c from a where a IN (select d from b ) 或者: select a,b,c from a where a IN (1,2,3)

    5、说明:显示文章、提交人和最后回复时间select a.title,a.username,b.adddate from table a,(select max(adddate) adddate from table where table.title=a.title) b

    6、说明:外连接查询(表名1:a 表名2:b)select a.a, a.b, a.c, b.c, b.d, b.f from a LEFT OUT JOIN b ON a.a = b.c

    7、说明:在线视图查询(表名1:a )select * from (SELECT a,b,c FROM a) T where t.a > 1;

    8、说明:between的用法,between限制查询数据范围时包括了边界值,not between不包括select * from table1 where time between time1 and time2select a,b,c, from table1 where a not between 数值1 and 数值2

    9、说明:in 的使用方法select * from table1 where a [not] in (‘值1’,’值2’,’值4’,’值6’)

    10、说明:两张关联表,删除主表中已经在副表中没有的信息 delete from table1 where not exists ( select * from table2 where table1.field1=table2.field1 )

    11、说明:四表联查问题:select * from a left inner join b on a.a=b.b right inner join c on a.a=c.c inner join d on a.a=d.d where .....

    12、说明:日程安排提前五分钟提醒 SQL: select * from 日程安排 where datediff('minute',f开始时间,getdate())>5

    13、说明:一条sql 语句搞定数据库分页select top 10 b.* from (select top 20 主键字段,排序字段 from 表名 order by 排序字段 desc) a,表名 b where b.主键字段 = a.主键字段 order by a.排序字段

    14、说明:前10条记录select top 10 * form table1 where 范围

    15、说明:选择在每一组b值相同的数据中对应的a最大的记录的所有信息(类似这样的用法可以用于论坛每月排行榜,每月热销产品分析,按科目成绩排名,等等.)select a,b,c from tablename ta where a=(select max(a) from tablename tb where tb.b=ta.b)

    16、说明:包括所有在 TableA 中但不在 TableB和TableC 中的行并消除所有重复行而派生出一个结果表(select a from tableA ) except (select a from tableB) except (select a from tableC)

    17、说明:随机取出10条数据select top 10 * from tablename order by newid()

    18、说明:随机选择记录select newid()

    19、说明:删除重复记录Delete from tablename where id not in (select max(id) from tablename group by col1,col2,...)

    20、说明:列出数据库里所有的表名select name from sysobjects where type='U'

    21、说明:列出表里的所有的select name from syscolumns where id=object_id('TableName')

    22、说明:列示type、vender、pcs字段,以type字段排列,case可以方便地实现多重选择,类似select 中的case。select type,sum(case vender when 'A' then pcs else 0 end),sum(case vender when 'C' then pcs else 0 end),sum(case vender when 'B' then pcs else 0 end) FROM tablename group by type显示结果:type vender pcs电脑 A 1电脑 A 1光盘 B 2光盘 A 2手机 B 3手机 C 3

    23、说明:初始化表table1

    TRUNCATE TABLE table1

    24、说明:选择从10到15的记录select top 5 * from (select top 15 * from table order by id asc) table_别名 order by id desc三、技巧1、1=1,1=2的使用,在SQL语句组合时用的较多“where 1=1” 是表示选择全部   “where 1=2”全部不选,如:if @strWhere !='' beginset @strSQL = 'select count(*) as Total from [' + @tblName + '] where ' + @strWhere endelse beginset @strSQL = 'select count(*) as Total from [' + @tblName + ']' end 我们可以直接写成set @strSQL = 'select count(*) as Total from [' + @tblName + '] where 1=1 安定 '+ @strWhere 2、收缩数据库--重建索引DBCC REINDEXDBCC INDEXDEFRAG--收缩数据和日志DBCC SHRINKDBDBCC SHRINKFILE3、压缩数据库dbcc shrinkdatabase(dbname)4、转移数据库给新用户以已存在用户权限exec sp_change_users_login 'update_one','newname','oldname'go

    5、检查备份集RESTORE VERIFYONLY from disk='E:/dvbbs.bak'

    6、修复数据库ALTER DATABASE [dvbbs] SET SINGLE_USERGODBCC CHECKDB('dvbbs',repair_allow_data_loss) WITH TABLOCKGOALTER DATABASE [dvbbs] SET MULTI_USERGO7、日志清除SET NOCOUNT ONDECLARE @LogicalFileName sysname,        @MaxMinutes INT,        @NewSize INT

    USE     tablename             -- 要操作的数据库名SELECT  @LogicalFileName = 'tablename_log',  -- 日志文件名@MaxMinutes = 10,               -- Limit on time allowed to wrap log.        @NewSize = 1                  -- 你想设定的日志文件的大小(M)

    -- Setup / initializeDECLARE @OriginalSize intSELECT @OriginalSize = size   FROM sysfiles  WHERE name = @LogicalFileNameSELECT 'Original Size of ' + db_name() + ' LOG is ' +         CONVERT(VARCHAR(30),@OriginalSize) + ' 8K pages or ' +         CONVERT(VARCHAR(30),(@OriginalSize*8/1024)) + 'MB'  FROM sysfiles  WHERE name = @LogicalFileNameCREATE TABLE DummyTrans  (DummyColumn char (8000) not null)

    DECLARE @Counter   INT,        @StartTime DATETIME,        @TruncLog  VARCHAR(255)SELECT  @StartTime = GETDATE(),        @TruncLog = 'BACKUP LOG ' + db_name() + ' WITH TRUNCATE_ONLY'

    DBCC SHRINKFILE (@LogicalFileName, @NewSize)EXEC (@TruncLog)-- Wrap the log if necessary.WHILE     @MaxMinutes > DATEDIFF (mi, @StartTime, GETDATE()) -- time has not expired      AND @OriginalSize = (SELECT size FROM sysfiles WHERE name = @LogicalFileName)        AND (@OriginalSize * 8 /1024) > @NewSize    BEGIN -- Outer loop.    SELECT @Counter = 0    WHILE  ((@Counter < @OriginalSize / 16) AND (@Counter < 50000))      BEGIN -- update        INSERT DummyTrans VALUES ('Fill Log')          DELETE DummyTrans        SELECT @Counter = @Counter + 1      END       EXEC (@TruncLog)    END   SELECT 'Final Size of ' + db_name() + ' LOG is ' +        CONVERT(VARCHAR(30),size) + ' 8K pages or ' +         CONVERT(VARCHAR(30),(size*8/1024)) + 'MB'  FROM sysfiles   WHERE name = @LogicalFileNameDROP TABLE DummyTransSET NOCOUNT OFF 8、说明:更改某个表exec sp_changeobjectowner 'tablename','dbo'9、存储更改全部表CREATE PROCEDURE dbo.User_ChangeObjectOwnerBatch @OldOwner as NVARCHAR(128), @NewOwner as NVARCHAR(128)AS

    DECLARE @Name   as NVARCHAR(128)DECLARE @Owner  as NVARCHAR(128)DECLARE @OwnerName  as NVARCHAR(128)

    DECLARE curObject CURSOR FOR  select 'Name'   = name,  'Owner'   = user_name(uid) from sysobjects where user_name(uid)=@OldOwner order by name

    OPEN  curObjectFETCH NEXT FROM curObject INTO @Name, @OwnerWHILE(@@FETCH_STATUS=0)BEGIN      if @Owner=@OldOwner  begin  set @OwnerName = @OldOwner + '.' + rtrim(@Name)  exec sp_changeobjectowner @OwnerName, @NewOwner end-- select @name,@NewOwner,@OldOwner

     FETCH NEXT FROM curObject INTO @Name, @OwnerEND

    close curObjectdeallocate curObjectGO

    10、SQL SERVER中直接循环写入数据declare @i intset @i=1while @i<30begin   insert into test (userid) values(@i)   set @i=@i+1end

    7月21日 17:19 | 添加评论  | 固定链接  | 引用通告 (0)  | 写入日志  | c# ASP.NET

    C#中处理鼠标相关的事件

    鼠标相关的事件大致有六种,分别是 :     "MouseHover"、"MouseLeave"、"MouseEnter"、"MouseMove"、"MouseDown"和"MouseUp"。   (1).如何在C#程序中定义这些事件:   在C#中是通过不同的Delegate来描述上述事件,其中描述"MouseHover"、"MouseLeave"、"MouseEnter"事件的Delegate是"EventHandler",而描述后面的三个事件的Delegate是"MouseEventHandler"来描述。这二个Delegate分别被封装在不同的命名空间,其中"EventHandler"被封装在"System"命名空间;"MouseEventHandler"被封装在"Syetem.Windows.Froms"命名空间中的。在为"MouseHover"、"MouseLeave"、"MouseEnter"事件通过数据的类是"EventArgs",他也被封装在"System"命名空间中;而为后面的三个事件提供数据的类是"MouseEventArgs",他却被封装在"Syetem.Windows.Froms"命名空间。以上这些就决定了在C#中定义这些事件和响应这些事件有着不同的处理办法。下面就来介绍这些不同点。   对于上述的前三个事件,是用以下语法来定义的:    "组件名称"."事件名称"+= new System.EventHandler("事件名称");   下面是程序中具体实现代码:    button1.MouseLeave += new Syetem.EvenHandler(button1_MLeave);   在完成了事件的定义以后,就要在程序中加入响应此事件的代码,否则程序编译的时候会报错。下面是响应上面事件的基本结构。 private void button1_MLeave ( object sender , System.EventArgs e ) { 此处加入响应此事件的代码 }   定义"MouseMove"、"MouseDown"和"MouseUp"事件的语法和前面介绍的三个事件大致相同,具体如下:    "组件名称"."事件名称"+= new System.Windows.Forms. MouseEventHandler("事件名称");   下面是程序中具体实现代码: button1.MouseMove += new System.Windows.Forms.MouseEventHandler(button1_MMove);   下面是响应上面事件的基本结构: private void button1_MMove ( object sender , System.Windows.Forms. MouseEventArgs e ) { 此处加入响应此事件的代码 }   注释:在上述程序中的"button1"是定义的一个按钮组件。 2).鼠标相关事件中的典型问题处理办法:   在掌握了C#中定义和鼠标相关的事件,我们就来探讨一下和鼠标相关事件的典型问题。其一是读取鼠标的当前位置;其二是判定到底是那个鼠标按键按动。   判定鼠标的位置可以通过事件"MouseMove"来处理,在"MouseEventArgs"类中提供了二个属性"X"和"Y",来判定当前鼠标纵坐标和横坐标。而判定鼠标按键的按动情况,可以通过事件"MouseDown"来处理,并且在"MouseEventArgs"类中也提供了一个属性"Button"来判定鼠标按键情况。根据这些知识,可以得到用C#编写的读取鼠标当前位置和判定鼠标按键情况的程序代码。下面就是此代码(mouse.cs)和此代码编译后运行界面: 图01:用C#读取鼠标位置和鼠标按键的程序运行界面    mouse.cs的源程序代码如下: using System ; using System.Drawing ; using System.Collections ; using System.ComponentModel ; using System.Windows.Forms ; using System.Data ; public class Form1 : Form { private System.ComponentModel.Container components = null ;  public Form1 ( ) { file://初始化窗体中的各个组件 InitializeComponent ( ) ; } file://清除程序中使用过的资源 protected override void Dispose ( bool disposing ) { if ( disposing ) { if (components != null) { components.Dispose ( ) ; } } base.Dispose ( disposing ) ; } private void InitializeComponent ( ) { this.AutoScaleBaseSize = new System.Drawing.Size ( 6 , 14) ; this.ClientSize = new System.Drawing.Size ( 292 , 273 ) ; this.Name = "Form1" ; this.Text = "C#处理鼠标按动事件!" ; file://为鼠标按动定义一个事件处理过程"Form1_MouseDown" this.MouseDown += new MouseEventHandler ( Form1_MouseDown ) ; file://为鼠标移动定义一个事件处理过程"Form1_MouseMove" this.MouseMove += new MouseEventHandler ( Form1_OnMouseMove ) ; } static void Main ( ) { Application.Run ( new Form1 ( ) ) ; } private void Form1_OnMouseMove ( object sender , MouseEventArgs e ) { this.Text = "当前鼠标的位置为:( " + e.X + " , " + e.Y + ")" ; } private void Form1_MouseDown ( object sender , MouseEventArgs e ) { file://响应鼠标的不同按键 if ( e.Button == MouseButtons.Left ) { MessageBox.Show ( "按动鼠标左键!" ) ; } if ( e.Button == MouseButtons.Middle ) { MessageBox.Show ( "按动鼠标中键!") ; } if ( e.Button == MouseButtons.Right ) { MessageBox.Show ( "按动鼠标右键!") ; } } } 三.C#中处理和键盘相关的事件:   在C#中和键盘相关的事件相对比较少,大致就三种:"KeyDown"、"KeyUp"和"KeyPress"。   (1).如何在C#程序中定义这些事件:     C#中描述"KeyDown"、"KeyUp"的事件的Delegate是"KeyEventHandler"。而描述"KeyPress"所用的Delegate是"KeyPressEventHandler"。这二个Delegate都被封装在命名空间"Syetem.Windows.Froms"中。为"KeyDown"、"KeyUp"的事件提供数据的类是"KeyEventArgs"。而为"KeyPress"事件提供数据的类是"KeyPressEventArgs"。同样这二者也被封装在命名空间"Syetem.Windows.Froms"中。   在C#程序定义"KeyDown"、"KeyUp"事件的语法如下:    "组件名称"."事件名称"+= new Syetem.Windows.Froms. KeyEventHandler("事件名称");   下面是程序中具体实现代码: button1. KeyUp += new Syetem.Windows.Froms. KeyEventHandler(button1_KUp);   下面是响应上面事件的基本结构。 private void button1_KUp ( object sender , Syetem.Windows.Froms. KeyEventArgs e ) { 此处加入响应此事件的代码 }   在C#程序定义"KeyPress"事件的语法如下:    "组件名称"."事件名称"+= new Syetem.Windows.Froms. KeyPressEventHandler("事件名称");   下面是程序中具体实现代码: button1. KeyPress += new Syetem.Windows.Froms. KeyPressEventArgs(button1_KPress);   在完成了事件的定义以后,就要在程序中加入响应此事件的代码,否则程序编译的时候会报错。下面是响应上面事件的基本结构。 private void button1_KPress ( object sender , Syetem.Windows.Froms. KeyPressEventArgs e ) { 此处加入响应此事件的代码 }   注释:程序中出现的"button1"是定义的一个按钮组件。 (2).和键盘相关事件中的典型问题处理办法:   和键盘相关的典型问题无非就是判定到底是哪个按键被按动。通过上面的三个事件都可以完成。并且在"KeyEventArgs"类中通过了一个属性"KeyCode",可以用他来读取当前按键。所以就在"KeyUp"或者"KeyDown"事件中处理这个问题。根据上面这些知识,可以得到用C#编写读取读取按键的程序代码,下面就是此代码(key.cs)和此代码运行后的界面:   图02:用C#读取键盘按键的程序运行界面    key.cs的代码如下: using System ; using System.Drawing ; using System.Collections ; using System.ComponentModel ; using System.Windows.Forms ; using System.Data ; public class Form1 : Form { private System.ComponentModel.Container components = null ; public Form1 ( ) { file://初始化窗体中的各个组件 InitializeComponent ( ) ; } protected override void Dispose ( bool disposing ) { file://清除程序中使用过的资源 if ( disposing ) { if ( components != null ) { components.Dispose ( ) ; } } base.Dispose ( disposing ) ; } private void InitializeComponent ( ) { this.AutoScaleBaseSize = new System.Drawing.Size ( 6 , 14 ) ; this.ClientSize = new System.Drawing.Size ( 292 , 273 ) ; this.Name = "Form1" ; this.Text = "C#处理键盘事件!" ; file://为按键的按动定义一个事件处理过程"Form1_KeyUp" this.KeyUp += new KeyEventHandler ( this.Form1_KeyUp ) ; } static void Main ( ) { Application.Run ( new Form1 ( ) ) ; } file://显示你所按动的按键名称 private void Form1_KeyUp ( object sender , KeyEventArgs e ) { MessageBox.Show ( e.KeyCode.ToString ( ) , "您所按动的健为:" ) ; } }    四.总结:   本文介绍了在C#中如何定义和鼠标和键盘相关的事件和在这些事件中一些典型问题的处理办法。虽然这些知识最为基本,但也最为重要,因为在程序设计中,这些问题和我们打交道的机会最多。当然和鼠标和键盘相关的事件和问题还有许多,可以参照根据上面的解决办法加以解决。 7月21日 11:28 | 添加评论  | 固定链接  | 引用通告 (0)  | 写入日志  | c# ASP.NET

    给删除控件添加确认信息

    给控件添加确认信息,方法如下:1、给控件加确认信息BtEdit.Attributes.Add("onclick", "return confirm('    确定修改?');");2、给DataGrid中的控件添加确认信息public void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)  {   if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem || e.Item.ItemType==ListItemType.EditItem)   {                /* 内容如下*/               }  }法1、利用控件ID寻找,用于自定义控件,而且很少控件很少的情况下用此方法。    LinkButton btnDel = (LinkButton)e.Item.FindControl("DeleteWork");    btnDel.Attributes.Add("onclick", "return confirm('您真的要删除此行吗?');");    btnDel.Text = "删除工作";法2、利用控件在表格中的控件的索引寻找添加,这个适用于子控件没有ID的,如DataGrid中的自带的删除按钮。    TableCell myTableCell;        myTableCell = e.Item.Cells[6];//定义对“删除”单元格的引用    LinkButton btnDel = (LinkButton)myTableCell.Controls[2];     btnDel.Attributes.Add("onclick", "return confirm('您真的要删除此工作吗?')");        btnDel.ID = "DeleteWork";   法3、推荐方案,先确定表格,在根据ID来寻找控件,再添加提醒信息,这个适用于表格多,控件多的情况,这样不容易混乱,很清晰。    TableCell myTableCell;        myTableCell = e.Item.Cells[6];//定义对“删除”单元格的引用    LinkButton btnDel = (LinkButton)myTableCell.FindControl("DeleteWork");     btnDel.Attributes.Add("onclick", "return confirm('您真的要删除此工作吗?')");        btnDel.Text = "删除工作";

    7月21日 11:27 | 添加评论  | 固定链接  | 引用通告 (0)  | 写入日志  | c# ASP.NET

    C#基础——关于类

    类实际上是创建对象的模板,每个对象都包含数据,并提供了处理和访问数据的方法。类定义了每个对象可以包含什么数据和功能,但类自己不能包含数据。比如一个类代表一个人,它就可以定义所以人相关的信息(身高、年龄、体重等)。使用时,事例化对象表示某一个人。 类的成员 可以分为两大类类本身所声明的以及从基类中继承而来的 类的成员有以下类型

    最新回复(0)