当前位置:   article > 正文

Bug库

((system.timers.timer)sender).enabled = false 报错


 netsh int tcp set global  ecn=disable

C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe C:\TESTWindowService\myWindowsService.exe 

C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /u C:\TESTWindowService\myWindowsService.exe 

 

 需要调用web.extent....

using System.Web.Script.Serialization;

JavaScriptSerializer json = new JavaScriptSerializer();

List<URL> urlList = new List<URL>();

json.Serialize(urlList);

public class URL
    {
        public int ID { get; set; }
        public string AD { get; set; }
        public int type { get; set; }
        public DateTime date { get; set; }
        public string time { get; set; }
        public string url { get; set; }
        public bool status { get; set; }
    }

添加服务器引用

           NextEVWebservice.WebService websvc = new NextEVWebservice.WebService();
            JavaScriptSerializer json = new JavaScriptSerializer();
            List<URL> urlList = json.Deserialize<List<URL>>(websvc.GetURL(adName));

 

SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite spSite = new SPSite(siteConfig.NEXTEVPortalWebUrl))
                {
                    using (SPWeb spWeb = spSite.OpenWeb())
                    {
                        
                        SPList m_objList1 = spWeb.Lists["NextEV Contacts"];
                        SPQuery query = new SPQuery();
                        SPListItemCollection list = m_objList1.GetItems(query);
                        foreach (SPItem item in list)
                        {
                            //查
                            string name = item["Nickname"].ToString();

                            //改
                            spWeb.AllowUnsafeUpdates = true;
                            item["Nickname"] = "测试";
                            item.Update();
                            spWeb.AllowUnsafeUpdates = false;

                            //删
                            spWeb.AllowUnsafeUpdates = true;
                            item.Delete();
                            spWeb.AllowUnsafeUpdates = false;

                            break;
                        }

                        //增
                        SPList m_objList2 = spWeb.Lists["NextEV Contacts"];
                        SPItem spitem = m_objList2.AddItem();
                        spWeb.AllowUnsafeUpdates = true;
                        spitem["Nickname"] = "测试";
                        spitem.Update();
                        spWeb.AllowUnsafeUpdates = false;
                    }
                }
            });

 

 

 private void Func()
        {
            System.Timers.Timer t = new System.Timers.Timer(40000); 毫秒
            t.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Click); //Timer_Click是到达时间的时候执行事件的函数

            //t.Elapsed += new ElapsedEventHandler((s, e) => OnTimedEvent(s, e, a));
            t.AutoReset = true; //设置是执行一次(false)还是一直执行(true)
            t.Enabled = true;
        }
        private void Timer_Click(Object sender, ElapsedEventArgs e)
        {
            ((System.Timers.Timer)sender).Enabled = false; //有不是时间短触发两次的试试
        }      

 如果要new带有UI控件的form时如带有webbrowser的form,需要加
BeginInvoke(new Action(() => { 创建或访问控件语句 }));
 

BeginInvoke(new Action(() =>
{
LetsShow Ls = new LetsShow(backUrl);
Ls.Show();
}));

 
 
UDP
发送端 
别忘了CheckForIllegalCrossThreadCalls = false;
 
        private void button1_Click(object sender, EventArgs e)
        {         
            System.Timers.Timer t = new System.Timers.Timer();
            t.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Click); //Timer_Click是到达时间的时候执行事件的函数
            //t.Elapsed += new ElapsedEventHandler((s, e) => OnTimedEvent(s, e, a));
            t.AutoReset = true; //设置是执行一次(false)还是一直执行(true)
            t.Enabled = true;
        }

        private void Timer_Click(Object sender, ElapsedEventArgs e)
        {
            string sendString = null;//要发送的字符串  
            byte[] sendData = null;//要发送的字节数组  
            UdpClient client = null;
            IPAddress remoteIP = IPAddress.Parse("192.168.1.102");
            int remotePort = 11000;
            IPEndPoint remotePoint = new IPEndPoint(remoteIP, remotePort);//实例化一个远程端点 
            sendString = textBox1.Text;
            sendData = Encoding.Default.GetBytes(sendString);
            client = new UdpClient();
            client.Send(sendData, sendData.Length, remotePoint);//将数据发送到远程端点  
            client.Close();//关闭连接  
        }      
接收
 private void button1_Click(object sender, EventArgs e)
        {
            Thread th = new Thread(new ThreadStart(rec));
            th.Start();
        }
        public void rec()
        {
            UdpClient client = null;
            string receiveString = null;
            byte[] receiveData = null;
            //实例化一个远程端点,IP和端口可以随意指定,等调用client.Receive(ref remotePoint)时会将该端点改成真正发送端端点  
            IPEndPoint remotePoint = new IPEndPoint(IPAddress.Parse("192.168.1.102"), 0);

            while (true)
            {
                client = new UdpClient(11000);
                receiveData = client.Receive(ref remotePoint);//接收数据  
                receiveString = Encoding.Default.GetString(receiveData);
                textBox1.Text = receiveString;
                client.Close();//关闭连接  
            }  
        }
 
 
 
因为webbrowser一般默认为IE5.5或者6 比较低级,js里的data都解析不了,所以需要迫使webbrowser强行加载本机最新IE内核
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 
限制Textbox只能打数字
 <asp:TextBox ID="JLR_COST_PRICE" CssClass="input inputwidth_210" runat="server" οnkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"></asp:TextBox>
/[^\d.]/g,''    小数  
/[^\-?\d.]/g,''  负数 小数
/^([1-9]\d*|0)(\.\d*[0-9])?$/
 超长 
SubStrLength: function (str, len) {
            var strstring = (str == null ? "null" : str);
            return (strstring.length > len ? strstring.substring(0, len) + "..." : strstring);
        }
 
 天朝省市区选择 淘宝js版
 <script type="text/javascript" src="//g.alicdn.com/msui/sm/0.6.2/js/sm-city-picker.min.js" charset="utf-8"></script>
 
<div>
        <div class="item-title label">选中地址</div>
   <div class="item-input">
      <input type="text"  id="area"/>
     </div>
</div>
</div>
 $(function () {
    $("#area").cityPicker({
        toolbarTemplate: '<header class="bar bar-nav">\
    <button class="button button-link pull-right close-picker">确定</button>\
    <h1 class="title">选择收货地址</h1>\
    </header>'
    });

});
 设置延时
  setTimeout(function () { location.href = "MyService.html"; }, 1000);
  ----------------------------------------------------------------------------------------------------------------------
查询个数据库死锁
  SELECT request_session_id spid,OBJECT_NAME(resource_associated_entity_id)tableName 
FROM sys.dm_tran_locks 
WHERE resource_type='OBJECT ' 

KILL 79 
 ----------------------------------------------------------------------------------------------------------------------
取消外键约束查询
 alter table tsb_user  NOCHECK constraint all
 ---------------------------------------------------------------------------------------------------------------------
取消外键约束

1.查询外键约束
select name
from sys.foreign_key_columns f join sys.objects o on f.constraint_object_id=o.object_id
where f.parent_object_id=object_id('tsb_User')

 2.拿到约束名,取消

alter table tsb_User drop constraint Reftsb_Shop12

  ----------------------------------------------------------------------------------------------------------------------
查看有哪些触发器
 select * from sysobjects where xtype='TR'

我的第一个触发器

USE [Luolai]
GO
/****** Object: Trigger [dbo].[tgr_User_insert] Script Date: 2017/1/6 17:45:31 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER trigger [dbo].[tgr_User_insert]
on [dbo].[tsb_Franchisee]
after insert --插入触发
as
begin
--if Update(tsb_Franchisee)
--定义变量
declare @UID varchar(36), @UserName varchar(36), @ULogin varchar(36),@FranchiseeID varchar(36),@Create_time datetime,@DataStatus varchar(16);
--在inserted表中查询已经插入记录信息
select @UID = FranchiseeCode, @UserName = FranchiseeName, @Create_time=Create_Time,@ULogin=FranchiseeCode,@FranchiseeID=FranchiseeID,@DataStatus=DataStatus from Inserted;
insert into tsb_User values(@UID,@UserName,'',@ULogin,'b148afbee2a478d307c7cef18c0ab954','','','','','','',@FranchiseeID,'','usertype.franchisee','',@DataStatus,'',@Create_time,'','');
end

 

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 NetJsonjson转类

Newtonsoft.Json.JsonConvert.DeserializeObject<QueryParam>(RequertParams.ToString());

asp.NET .ashx文件使用server.mappath解决方法:

System.Web.HttpContext.Current.Server.MapPath

在类文件中使用:

System.Web.HttpServerUtility server = System.Web.HttpContext.Current.Server;
server.MapPath(...)

   <input class="form-control ng-untouched ng-pristine ng-invalid" placeholder="" type="text"  required=""value="" id="txtBeginDay" name="beginday" οnclick="WdatePicker({ dateFmt: 'yyyy-MM-dd', maxDate: '#F{$dp.$D(\'txtEndDay\')}' });"/>

 

 <input class="form-control ng-untouched ng-pristine ng-invalid" placeholder="" type="text" value="" id="txtEndDay" name="endday" οnclick="WdatePicker({ dateFmt: 'yyyy-MM-dd', minDate: '#F{$dp.$D(\'txtBeginDay\')}' });"  />

转载于:https://www.cnblogs.com/18553325o9o/p/4741290.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/739434
推荐阅读
相关标签
  

闽ICP备14008679号