03 2011 档案
摘要:static void Main() { SqlParameter para = new SqlParameter("wq", 0); Console.WriteLine(para.SqlDbType);//输出BigInt, Console.WriteLine(para.Value==null);//输出true //难道new SqlParameter("wq", 0);调用的是SqlParameter(string parameterName, SqlDbType dbType)这个重载?微软的Bug? para.Value = 0; Consol
阅读全文
摘要:class.cst内容如下:<%@ CodeTemplate Language="C#" TargetLanguage="C#" Debug="False" ResponseEncoding="utf-8"%><%@ Assembly Name="System.Windows.Forms" %><%@ Import Namespace="System.Windows.Forms" %> <script runat="temp
阅读全文
摘要:static void Main() { Thread t1 = new Thread(Thread1); Thread t2 = new Thread(Thread2); t1.Start(); Thread.Sleep(100); t2.Start(); } static void Thread1() { Semaphore sema = new Semaphore(2, 3, "my"); sema.WaitOne(); sema.WaitOne(); Console.WriteLine("Thread1 get the Semaphore : "
阅读全文
摘要:1.排它锁在一个Sql连接中这样写:begin tran--select * from a with(UPDLOCK)update a set [name]='wq' where [id]=2 --这里的set的值不能不变(即不能本来name='wq'又set name='wq'),否则Sql Server会优化成不加锁waitfor delay '00:00:08'commit tran在另外一个sql连接中这样写:select * from a 发现第二个连接里的sql语句必须等到第一个连接里的事务完成才执行完成,这是因为第一
阅读全文
摘要:using System;using System.Threading;using System.Runtime.Remoting.Contexts;namespace ConsoleApplication4{ [Synchronization] public class MyCounter : ContextBoundObject { private int _expectedCounterVal; private int _currentCounterVal; private ManualResetEvent _event = new ManualResetEvent(false); pu
阅读全文
浙公网安备 33010602011771号