SPMetal 日志导出Caml语句

    protected void Page_Load(object sender, EventArgs e)
        {
            System.IO.TextWriter log;
            string path = @"c:\TestLinqSQL.txt";
            log = System.IO.File.AppendText(path);
            using (LinqDemoTestDataContext SDataContext = new LinqDemoTestDataContext("http://win"))
            {
                SDataContext.Log = log;
                var item = (from policy in SDataContext.Product
                            where policy.MyNumber == "HasModified"
                            select policy).Single();
                if (item != null)
                {
                    item.MyNumber = "1111111111";
                }
                SDataContext.SubmitChanges();
                log.Close();
            };
        }

posted @ 2013-05-14 01:28  Star★  阅读(166)  评论(0编辑  收藏  举报