代码改变世界

随笔分类 -  DotNet

Sql Server:索引使用情况及优化的相关 Sql

2011-12-02 11:04 by Tracy., 338 阅读, 收藏, 编辑
摘要: --Begin Index(索引) 分析优化的相关 Sql -- 返回当前数据库所有碎片率大于25%的索引-- 运行本语句会扫描很多数据页面-- 避免在系统负载比较高时运行-- 避免在系统负载比较高时运行declare @dbid intselect @dbid = db_id()SELECT o.name as tablename,s.* FROM sys.dm_db_index_physical_stats (@dbid, NULL, NULL, NULL, NULL) s,sys.objects owhere avg_fragmentation_in_percent>25 and 阅读全文

left join on ...and ... 与left join on ... where.. 的区别

2011-08-29 17:31 by Tracy., 535 阅读, 收藏, 编辑
摘要: create table UserAccount( UID int, UName varchar(50), JoinDate datetime)insert into UserAccount values(1,'Jimmy','2006-10-3')insert into UserAccount values(2,'Jack','2006-10-25')insert into UserAccount values(3,'Mike','2006-11-13')insert into UserAccou 阅读全文

AutoResetEvent 与 ManualResetEvent送花例子

2010-10-25 17:13 by Tracy., 408 阅读, 收藏, 编辑
摘要: 在.Net多线程编程中,AutoResetEvent和ManualResetEvent这两个类经常用到, 他们的用法很类似,但也有区别。Set方法将信号置为发送状态,Reset方法将信号置为不发送状态,WaitOne等待信号的发送。可以通过构造函数的参数值来决定其初始状态,若为true则非阻塞状态,为false为阻塞状态。如果某个线程调用WaitOne方法,则当信号处于发送状态时,该线程会得到信号... 阅读全文

ManualResetEvent用法

2010-10-25 16:53 by Tracy., 463 阅读, 收藏, 编辑
摘要:   转之:http://blog.tom.com/blog/read.php?bloggerid=313638&blogid=13505 Thread and Sync In C# (C#中的线程与同步) 别相信别人告诉你的所有的事。其实C#中的线程是很简单的。 线程是程序中的控制流程的封装。你可能已经习惯于写单线程程序,也就是,程序在它们的代码中一次只在一条路中执行。如果你多... 阅读全文

关于AutoResetEvent和ManualResetEvent

2010-10-25 16:35 by Tracy., 362 阅读, 收藏, 编辑
摘要: 两者都继承自EventWaitHandle,自然也就有点相通的地方了 简单来说,无论是AutoResetEvent还是ManualResetEvent,都是通过发出Signal信号来通知正在等待的线程的。有人可能要问,为什么要用它们来做这些事情, 嗯, 是这样的, 在.Net的多线程环境中,资源的共享变得尤其重要,如果没有一个有效的方法来维护资源的原子状态,在抢占式的CPU环境中,所有的事情都会... 阅读全文

[VS2010] ADO.NET Entity Framework 新功能:模型優先設計 (Model First Design)

2010-08-12 17:10 by Tracy., 729 阅读, 收藏, 编辑
摘要: ADO.NET Entity Framework 可說是 ADO.NET 進化下的重要產物之一,它是微軟的第一個 ORM (Object-Relational Mapping) 解決方案,它的出現也間接的讓 LINQ 能夠控制到關聯式資料庫,並且取代 LINQ to SQL 成為微軟欽定的 LINQ to Database 的核心類別庫,而它的主要設計工具 Entity Data Model De... 阅读全文

Creating the School Sample Database (Entity Framework Quickstart)

2010-08-12 16:50 by Tracy., 371 阅读, 收藏, 编辑
摘要: In this task, you will create the schema for the School database and load data into the database. To do this, you use SQL Server Management Studio or SQL Server Management Studio Express to execute a ... 阅读全文

Net中de日期格式

2010-08-10 13:44 by Tracy., 343 阅读, 收藏, 编辑
摘要: 日期转化一 为了达到不同的显示效果有时,我们需要对时间进行转化,默认格式为:2010-01-03 14:33:34 ,要转化为其他格式,要用到DateTime.ToString的方法(String, IFormatProvider),如下所示: using System; using System.Globalization; String format="D"; DateTi... 阅读全文

EZConnect to oracle server

2010-08-05 17:25 by Tracy., 834 阅读, 收藏, 编辑
摘要: Connection Setup Quick Start ====================================================== There are a number of methods to connect Oracle client to a database server. Two of the most common include EZCONNEC... 阅读全文

ODP.NET Tip: Bind Variables and the BindByName Property

2010-08-05 17:01 by Tracy., 403 阅读, 收藏, 编辑
摘要: When using bind variables in the CommandText property of an OracleCommand object, it is important to understand the meaning of the value of the BindByName property for the OracleCommand object. This p... 阅读全文

ODP.NET Tip of the Month Archives

2010-08-05 16:50 by Tracy., 849 阅读, 收藏, 编辑
摘要: ODP.NET Tip of the Month ArchivesNovember 2003: Using Dynamic Help ODP.NET Dynamic Help is integrated inside of Visual Studio .NET. Just hit the F1 key when your cursor is on an ODP.NET API and help p... 阅读全文

Comparing the Microsoft .NET Framework 1.1 Data Provider for Oracle and the Oracle Data Provider for .NET

2010-07-28 16:51 by Tracy., 956 阅读, 收藏, 编辑
摘要: Applies to:.NET FrameworkOracle Data Provider for .NET (ODP.NET) 9iMicrosoft .NET Framework 1.1 Data Provider for OracleSummary: Get a comparison of the strengths of the two most common .NET data prov... 阅读全文

Returning Ranked Results with Microsoft SQL Server 2005

2010-07-22 16:41 by Tracy., 390 阅读, 收藏, 编辑
摘要: IntroductionIn early November 2005, Microsoft launched three new product lines: Visual Studio 2005, SQL Server 2005, and the .NET Framework version 2.0 (which includes ASP.NET version 2.0). SQL Server... 阅读全文

Debugging SQL Server 2005 Stored Procedures in Visual Studio

2010-07-22 15:59 by Tracy., 452 阅读, 收藏, 编辑
摘要: IntroductionWith Microsoft SQL Server 2000 it was possible to debug stored procedures from directly within Query Analyzer (see Debugging a SQL Stored Procedure from inside SQL Server 2000 Query Analyz... 阅读全文

An Extensive Examination of LINQ: Querying and Searching XML Documents Using LINQ to XML

2010-07-22 13:36 by Tracy., 294 阅读, 收藏, 编辑
摘要: IntroductionXML is an increasingly popular way to encode documents, data, and electronic messages. Over the years Microsoft has offered a variety of libraries to facilitate creating, modifying, queryi... 阅读全文

根据原文件生成指定的静态文件

2010-07-21 15:58 by Tracy., 241 阅读, 收藏, 编辑
摘要: public class CreateHtmlHelper { public CreateHtmlHelper() { } /// <summary> /// 根据原文件生成指定的静态文件 /// </summary> /// <param name="_SourceFileName">原文件【虚拟路径】,如aspx</param> /// <... 阅读全文

ASPNET下的路径辅助类

2010-07-21 15:51 by Tracy., 222 阅读, 收藏, 编辑
摘要: using System; using System.Web; namespace SysClassLibrary.Common { /// <summary> /// Application 的摘要说明。 /// 网站相关路径信息 /// </summary> public class Application :System.Web.HttpAppl... 阅读全文

转:Querying a Hierarchical Parent-Child Structure in LINQ

2010-07-19 17:23 by Tracy., 293 阅读, 收藏, 编辑
摘要: To print the results, I am using a utility class called ObjectDumper which can be obtained from here. The structure of the classes representing a Parent-Child relationship is shown below. Each Departm... 阅读全文

转:Are You A Good Developer?

2010-07-19 16:57 by Tracy., 428 阅读, 收藏, 编辑
摘要: Are You A Good Developer?'Good' means having qualities that are desirable and distinguishing. From a developer's perspective, these qualities are both technical as well as non-technical. Here are some... 阅读全文

用DateTime.ToString(string format)输出不同格式的日期

2010-07-02 15:03 by Tracy., 372 阅读, 收藏, 编辑
摘要: DateTime.ToString()函数有四个重载。一般用得多的就是不带参数的那个了。殊不知,DateTime.ToString(string format)功能更强大,能输出不同格式的日期。以下把一些情况罗列出来,供大家参考。有些在MSDN上有的就没有列出来了。1. y代表年份,注意是小写的y,大写的Y并不代表年份。2. M表示月份。3. d表示日期,注意D并不代表什么。4. h或H表示小时,... 阅读全文