·ÀÖ¹SQL×¢Èë
×î½ü¿´µ½ºÜ¶àÈ˵ÄÍøÕ¾¶¼±»×¢Èëjs,±»iframeÖ®ÀàµÄ¡£·Ç³£¶à¡£
±¾ÈËÔø½ÓÊÖ¹ýÒ»¸ö±È½Ï´óµÄÍøÕ¾£¬±»È˼ÒÈëÇÖÁË£¬ÒªÎÒÊÕʰ²Ð¾Ö¡£¡£
1.Ê×ÏÈÎÒ»á¼ì²éһϷþÎñÆ÷ÅäÖã¬ÖØÐÂÅäÖÃÒ»´Î·þÎñÆ÷°²È«£¬¿ÉÒԲο¼
http://hi.baidu.com/zzxap/blog/item/18180000ff921516738b6564.html
2.Æä´Î£¬ÓÃÂó¿§·È×Ô¶¨Òå²ßÂÔ£¬¼´Ê¹ÍøÕ¾³ÌÐòÓЩ¶´£¬±ðÈËÒ²ºÜÄÑÔÚÎļþÉÏдÈë´úÂëÁË¡£
²Î¿¼×Ô¶¨Òå²ßÂÔ£¬ÓÐÁËÕâ¸ö²ßÂÔ£¬ÔÙÀõijÌÐò£¬ÄãÒ²ÎÞ·¨Ð´ÈëÎÒµÄÎļþ
http://hi.baidu.com/zzxap/blog/item/efe093a7e0f2c190d04358ef.html
3.¿ÉÒÔÓÃÍøÂ糬¼¶Ñ²¾¯É¾³ý±»×¢ÈëµÄJS´úÂë¡£
²Î¿¼
http://hi.baidu.com/anlish/blog/item/ba45bb18eac77e0534fa4134.html
4.ÈçºÎÅúÁ¿É¾³ýÊý¾Ý¿âÖб»×¢ÈëµÄ´úÂ룿
ÔÚÊý¾Ý¿â²éѯ·ÖÎöÆ÷ÔËÐÐÕâ¶Î´úÂë¼´¿É
SQL code
DECLARE @fieldtype sysname
SET @fieldtype='varchar'
--ɾ³ý´¦Àí
DECLARE hCForEach CURSOR GLOBAL
FOR
SELECT N'update '+QUOTENAME(o.name)
+N' set '+ QUOTENAME(c.name) + N' = replace(' + QUOTENAME(c.name) + ',''<script_src=http://ucmal.com/0.js> </script>'','''')'
from sysobjects o,syscolumns c,systypes t
WHERE o.id=c.id
AND OBJECTPROPERTY(o.id,N'IsUserTable')=1
AND c.xusertype=t.xusertype
AND t.name=@fieldtype
EXEC sp_MSforeach_Worker @command1=N'?'
5.´´½¨Ò»¸ö´¥·¢Æ÷£¬Ö»ÒªÓÐ </script>¾Í²»¸ø²åÈ룬¶ÔÐÔÄÜ»áÓеãÓ°Ïì
SQL code
create trigger tr_table_insertupdate
on tablename
for insert,update
as
if exists (
select 1 from inserted
where data like '%</script>%'
)
begin
RAISERROR ('²»ÄÜÐ޸ĻòÕßÌí¼Ó',16,1);
ROLLBACK TRANSACTION
end
go
6.×îÖØÒªµÄ»¹ÊdzÌÐòµÄд·¨£¬ÓòÎÊý»¯SQL»ò´æ´¢¹ý³Ì
ÀýÈç
C# code
protected void cmdok_Click(object sender, EventArgs e)
{
//Ìí¼ÓÐÅÏ¢
StringBuilder sql = new StringBuilder( " insert into m_phone ( pid,PhoneName,num,price,phonetype,onSellTime,color,weight,Video,Camera,phoneSize,phoneSystem,Memorysize,PhoneDesc,Standbytime,ScreenSize,Frequency,InputMethod,Soundrecord,gps,fm,mp3,email,Infrared,game,clock,Calendar,Calculator,Bluetooth) ");
sql.Append(" values (@pid,@TextPhon
Ïà¹ØÎĵµ£º
http://www.cnblogs.com/yinzhenzhixin/archive/2009/01/07/1371064.html
ÔÚSQLÓï¾äÖУ¬UNION¹Ø¼ü×Ö¶àÓÃÀ´½«²¢ÁеĶà×é²éѯ½á¹û(±í)ºÏ²¢³ÉÒ»¸ö½á¹û(±í)£¬¼òµ¥ÊµÀýÈçÏ£º
SELECT [Id],[Name],[Comment] from [Product1]
UNION
SELECT [Id],[Name],[Comment] from [Product2]
ÉÏÃæµÄ´úÂë¿ ......
ÓÐʱÔÚ×ö³ÌÐòʱ£¬²âÊÔʱµÄÊý¾Ý£¬ÒªÄÃÏñÓû§ÑÝʾ£¬Êý¾Ý¿âµÄ¸½¼ÓÊÇ×îÖ±½ÓµÄ°ì·¨£¬µ«Èô´ÓSQL Server 2005תÏò2000µ¼³öÂé·³£¬ÄÚÈÝÒ²¶à£¬Éú³ÉSQLÓï¾äÊÇ×îºÃµÄ°ì·¨£¬Ò²ÊÇÔÚÍøÉÏÕҵŤ¾ß,mssql2µ¼³ö·Ç³£·½±ã£¬µ£ÐÄÎÒÒÔºóÄѵÃÕÒËùÒÔ·ÅÔÚÕâÀÒÔ±¸ºóÓᣠ......
select *from student
select student_id from student
select student_id ,student_name from student
select student_id student_name from student ½«student_name ×÷Ϊstudent_idµÄ±ðÃû´¦Àí
È磺 select student_id a from student
select a=student_id from student
´Óstudent±íÖзֱð¼ ......
countÓï¾äÖ§³Ö*¡¢ÁÐÃû¡¢³£Á¿¡¢±äÁ¿,²¢ÇÒ¿ÉÒÔÓÃdistinct¹Ø¼ü×ÖÐÞÊΣ¬ ²¢ÇÒcount(ÁÐÃû)²»»áÀÛ¼ÆnullµÄ¼Ç¼¡£ÏÂÃæËæ±ãÓÃһЩÀý×Óʾ·¶Ò»ÏÂcountµÄ¹æÔò£º±ÈÈç¶ÔÈçϱí×öͳ¼Æ£¬ËùÓÐÁÐÕâÀï¶¼ÓÃsql_variantÀàÐÍÀ´±íʾ¡£
if (object_id ('t_test' )> 0 )
drop table t_test
go
create table t_test (a ......