C#Àï¹ØÓÚ¶¨Ê±Æ÷Àà
¹ØÓÚC#ÖÐtimerÀà ÔÚC#Àï¹ØÓÚ¶¨Ê±Æ÷Àà¾ÍÓÐ3¸ö
1.¶¨ÒåÔÚSystem.Windows.FormsÀï
2.¶¨ÒåÔÚSystem.Threading.TimerÀàÀï
3.¶¨ÒåÔÚSystem.Timers.TimerÀàÀï
System.Windows.Forms.TimerÊÇÓ¦ÓÃÓÚWinFormÖеģ¬ËüÊÇͨ¹ýWindowsÏûÏ¢»úÖÆʵÏֵģ¬ÀàËÆÓÚVB»òDelphiÖеÄTimer¿Ø¼þ£¬ÄÚ²¿Ê¹ÓÃAPI SetTimerʵÏֵġ£ËüµÄÖ÷ҪȱµãÊǼÆʱ²»¾«È·£¬¶øÇÒ±ØÐëÓÐÏûϢѻ·£¬Console Application(¿ØÖÆ̨ӦÓóÌÐò)ÎÞ·¨Ê¹Óá£
System.Timers.TimerºÍSystem.Threading.Timer·Ç³£ÀàËÆ£¬ËüÃÇÊÇͨ¹ý.NET Thread PoolʵÏֵģ¬ÇáÁ¿£¬¼Æʱ¾«È·£¬¶ÔÓ¦ÓóÌÐò¡¢ÏûϢûÓÐÌرðµÄÒªÇó¡£System.Timers.Timer»¹¿ÉÒÔÓ¦ÓÃÓÚWinForm£¬ÍêÈ«È¡´úÉÏÃæµÄTimer¿Ø¼þ¡£ËüÃǵÄȱµãÊDz»Ö§³ÖÖ±½ÓµÄÍÏ·Å£¬ÐèÒªÊÖ¹¤±àÂë¡£
Àý£º
ʹÓÃSystem.Timers.TimerÀà
System.Timers.Timer t = new System.Timers.Timer(10000);//ʵÀý»¯TimerÀ࣬ÉèÖüä¸ôʱ¼äΪ10000ºÁÃ룻
t.Elapsed += new System.Timers.ElapsedEventHandler(theout);//µ½´ïʱ¼äµÄʱºòÖ´ÐÐʼþ£»
t.AutoReset = true;//ÉèÖÃÊÇÖ´ÐÐÒ»´Î£¨false£©»¹ÊÇÒ»Ö±Ö´ÐÐ(true)£»
t.Enabled = true;//ÊÇ·ñÖ´ÐÐSystem.Timers.Timer.Elapsedʼþ£»
public void theout(object source, System.Timers.ElapsedEventArgs e)
{
MessageBox.Show("OK!");
}
Ïà¹ØÎĵµ£º
ÓõÄÊÇÒ»Öֺܱ¿µÄ·½·¨£¬µ«¿ÉÒÔ°ïÖú³õѧÕßÁ˽â·ÃÎÊXML½ÚµãµÄ¹ý³Ì¡£
ÒÑÖªÓÐÒ»¸öXMLÎļþ£¨bookstore.xml£©ÈçÏÂ:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
&n ......
xmlpost by HttpWebRequest:
protected string PostXmlToURL(string url,string data)
{
HttpWebRequest hwr = (HttpWebRequest)HttpWebRequest.Create(url);
hwr.Method = "POST";
Stream stream = hwr.GetRequestStream();
StreamWri ......
±¾ÎÄת×Ô£ºhttp://blog.csdn.net/jinjazz/archive/2008/07/14/2650506.aspx
½«oledb¶ÁÈ¡µÄexcelÊý¾Ý¿ìËÙ²åÈëµÄsqlserverÖУ¬ºÜ¶àÈËͨ¹ýÑ»·À´Æ´½Ósql£¬ÕâÑù×ö²»µ«ÈÝÒ׳ö´í¶øÇÒЧÂʵÍÏ£¬×îºÃµÄ°ì·¨ÊÇʹÓÃbcp£¬Ò²¾ÍÊÇSystem.Data.SqlClient.SqlBulkCopy ÀàÀ´ÊµÏÖ¡£²»µ«Ëٶȿ죬¶øÇÒ´úÂë¼òµ¥£¬ÏÂÃæ²âÊÔ´ú ......
ÓÃÁËADO.NET 2.0 SQLite Data Provider ÕâÑù¿ÉÒÔÖ±½ÓÀûÓÃËüÀ´´´½¨Ò»¸ö¼ÓÃܵÄsqliteÊý¾Ý¿â¡£
ÓйØc#´úÂëÈçÏ£º
1¡¢´´½¨¿ÕµÄsqliteÊý¾Ý¿â¡£
//Êý¾Ý¿âÃûµÄºó׺Äã¿ÉÒÔÖ±½ÓÖ¸¶¨£¬ÉõÖÁûÓкó׺¶¼¿ÉÒÔ
//·½·¨Ò»£º´´½¨Ò»¸ö¿ÕsqliteÊý¾Ý¿â£¬ÓÃIOµÄ·½Ê½
FileStream fs = File.Create(“c:\\test.db“);
//·½·¨¶þ£ºÓ ......