日期:2014-05-20 浏览次数:20486 次
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'?'
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
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,@TextPhoneName,@Textnum,@Textprice,@Dropphonetype2,@TextonSellTime,@Textcolor,@Textweight "); ................. SqlParameter[] paras = { new SqlParameter("@pid", SqlDbType.Int, 4) , new SqlParameter("@TextPhoneName", SqlDbType.NVarChar, 50) , new SqlParameter("@Textnum", SqlDbType.Int, 4) , new SqlParameter("@Textprice", SqlDbType.Int, 4) , new SqlParameter("@Dropphonetype2", SqlDbType.VarChar, 20) , new SqlParameter("@TextonSellTime", SqlDbType.DateTime, 8) , new SqlParameter("@Textcolor", SqlDbType.VarChar, 20) , new SqlParameter("@Textweight", SqlDbType.NVarChar, 50) , ........... }; string[] stra = {Dropphonetype.SelectedValue,TextPhoneName.Text , Textnum.Text, Textprice.Text, Dropphonetype2.SelectedValue, TextonSellTime.Text, Textcolor.Text, Textweight.Text, .............}; int a=stra.Length; int j; for ( j = 0; j < a; j++) { paras[j].Value = stra[j]; } int strpid = 0; string sqla = sql.ToString(); try { SqlHelper.ExcuteNonQurey(sqla, CommandType.Text, paras);//执行添加数据 strpid = Convert.ToInt32(SqlHelper.ExcuteSclare(sqla, CommandType.Text, paras)); //获取刚才插入的id号 } catch (SqlException ex) { cmdreturn.Text = ex.Message.ToString(); } cmdreturn.Text = strpid.ToString(); 。。。。。。。。。
传输 string szTmp = "safdsfdsafdsfytrsd"; szTmp = Server.UrlEncode(szTmp); 接收 STRING STRA=Server.UrlDecode(request.querystring(szTmp));