<?xml version="1.0" encoding="gb2312"?>

<!-- RSS generated by oioj.net on 4/16/2004 ; 感谢LeXRus提供 RSS 2.0 文档; 此文件可自由使用，但请保留此行信息 --> 
<!-- Source download URL: http://blogger.org.cn/blog/rss2.asp       -->
<rss version="2.0">

<channel>
<title>执著</title>
<link>http://blogger.org.cn/blog/blog.asp?name=yjzhg</link>
<description>执著的博客</description>
<copyright>blogger.org.cn</copyright>
<generator>W3CHINA Blog</generator>
<webMaster>webmaster@blogger.org.cn</webMaster>
<item>
<title><![CDATA[正规判断email]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=23556</link>
<author>yjzhg</author>
<pubDate>2007/3/30 14:45:15</pubDate>
<description><![CDATA[<P>&nbsp;&nbsp;function checkemail(inputemail) //设置参数值<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;var email = inputemail.value;<BR>&nbsp;&nbsp;&nbsp;var re = <A>/^.+@.+\..{2,3}$/</A><BR>&nbsp;&nbsp;&nbsp;if (re.test(email))<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;var tempstring = email.split("@")<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (tempstring[2] == undefined)&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return false;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;return false;<BR>&nbsp;&nbsp;}</P>]]></description>
</item><item>
<title><![CDATA[文件md5值]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=23026</link>
<author>yjzhg</author>
<pubDate>2007/3/4 21:35:01</pubDate>
<description><![CDATA[<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public static string md5_hash(string path)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FileStream get_file = new FileStream(path, FileMode.Open, FileAccess.Read,</P>
<P>FileShare.Read);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.Security.Cryptography.MD5CryptoServiceProvider get_md5 = new</P>
<P>System.Security.Cryptography.MD5CryptoServiceProvider();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; byte[] hash_byte = get_md5.ComputeHash(get_file);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string resule = System.BitConverter.ToString(hash_byte);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resule = resule.Replace("-", "");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return resule;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (Exception e)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return e.ToString();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</P>]]></description>
</item><item>
<title><![CDATA[javascript:操作url参数的函数]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=21803</link>
<author>yjzhg</author>
<pubDate>2007/1/16 15:25:16</pubDate>
<description><![CDATA[
<P>平时不做javascript开发的，但是最近的web项目用到，自已写的，</P>
<P>&nbsp;&nbsp;&lt;script language="javascript"&gt;<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;function getQueStr(url,ref) //取获参数值<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;var str = url.substr(url.indexOf('?')+1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(str.indexOf('&amp;')!=-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var arr = str.split('&amp;');<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(i in arr)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(arr[i].split('=')[0]==ref)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return arr[i].split('=')[1];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return url.substr(url.indexOf('=')+1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;function setQueStr(url,ref,value) //设置参数值<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;var str = "";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (url.indexOf('?') !=-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str = url.substr(url.indexOf('?')+1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return url + "?" + ref + "=" + value;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;var returnurl="";<BR>&nbsp;&nbsp;&nbsp;&nbsp;var setparam = "";&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;var arr;<BR>&nbsp;&nbsp;&nbsp;&nbsp;var modify = "0";</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;if(str.indexOf('&amp;')!=-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;arr = str.split('&amp;');<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(i in arr)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(arr[i].split('=')[0]==ref)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setparam = value;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modify = "1";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setparam = arr[i].split('=')[1];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</P>
<P>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returnurl = returnurl + arr[i].split('=')</P>
<P>[0] + "=" + setparam + "&amp;";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returnurl = returnurl.substr(0,returnurl.length-</P>
<P>1);<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (modify == "0") <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (returnurl == str)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returnurl = returnurl + "&amp;" + ref </P>
<P>+ "=" + value;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (str.indexOf('=')!=-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;arr = str.split('=');<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(arr[0]==ref)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setparam = value;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;modify = "1";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setparam = arr[1];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returnurl = arr[0] + "=" + setparam;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (modify == "0")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (returnurl == str)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returnurl = returnurl + </P>
<P>"&amp;" + ref + "=" + value;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returnurl = ref + "=" + value;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;return url.substr(0,url.indexOf('?')) + "?" + returnurl;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;function delQueStr(url,ref) //删除参数值<BR><BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;var str = "";<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (url.indexOf('?') !=-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str = url.substr(url.indexOf('?')+1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return url;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;var arr = "";<BR>&nbsp;&nbsp;&nbsp;&nbsp;var returnurl="";<BR>&nbsp;&nbsp;&nbsp;&nbsp;var setparam = "";&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(str.indexOf('&amp;')!=-1)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;arr = str.split('&amp;');<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(i in arr)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(arr[i].split('=')[0] !=ref)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;returnurl = returnurl + arr</P>
<P>[i].split('=')[0] + "=" + arr[i].split('=')[1] + "&amp;";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return url.substr(0,url.indexOf('?')) + "?" + </P>
<P>returnurl.substr(0,returnurl.length-1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;arr = str.split('=');<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (arr[0]==ref)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return url.substr(0,url.indexOf('?'));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return url;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&lt;/script&gt;
<SCRIPT language=javascript>
		
			function alertstr()
			{
				window.location.href = delQueStr(window.location.href,"aa");
			}
		
			function getQueStr(url,ref)
			{
				var str = url.substr(url.indexOf('?')+1);
				if(str.indexOf('&')!=-1)
				{
					var arr = str.split('&');
					for(i in arr)
					{
						if(arr[i].split('=')[0]==ref)
							return arr[i].split('=')[1];
					}
				}
				else
				{
					return url.substr(url.indexOf('=')+1)
				}
			}
			
			function setQueStr(url,ref,value)
			{
				var str = "";
								
				if (url.indexOf('?') !=-1)
					str = url.substr(url.indexOf('?')+1);
				else
					return url + "?" + ref + "=" + value;
					
					
				var returnurl="";
				var setparam = "";				
				var arr;
				var modify = "0";

				if(str.indexOf('&')!=-1)
				{
					arr = str.split('&');
					
					for(i in arr)
					{
						if(arr[i].split('=')[0]==ref)
						{
							setparam = value;
							modify = "1";
						}
						else
						{
							setparam = arr[i].split('=')[1];
						}
													
						returnurl = returnurl + arr[i].split('=')[0] + "=" + setparam + "&";
					}
					
					returnurl = returnurl.substr(0,returnurl.length-1);
		
					if (modify == "0") 
						if (returnurl == str)
							returnurl = returnurl + "&" + ref + "=" + value;
				}
				else
				{
					if (str.indexOf('=')!=-1)
					{
						arr = str.split('=');
						
						if(arr[0]==ref)
						{			
							setparam = value;
							modify = "1";
						}
						else
						{
							setparam = arr[1];
						}
							
						returnurl = arr[0] + "=" + setparam;
										
						if (modify == "0")
							if (returnurl == str)
								returnurl = returnurl + "&" + ref + "=" + value;
					}	
					else
						returnurl = ref + "=" + value;	
				}
				
				return url.substr(0,url.indexOf('?')) + "?" + returnurl;
			}
			
			function delQueStr(url,ref)
			{
				var str = "";
				
				if (url.indexOf('?') !=-1)
					str = url.substr(url.indexOf('?')+1);
				else
					return url;
					
				
				var arr = "";
				var returnurl="";
				var setparam = "";	
				
				if(str.indexOf('&')!=-1)
				{								
					arr = str.split('&');
					
					for(i in arr)
					{
						if(arr[i].split('=')[0] !=ref)
						{
							returnurl = returnurl + arr[i].split('=')[0] + "=" + arr[i].split('=')[1] + "&";
						}						
					}
					
					return url.substr(0,url.indexOf('?')) + "?" + returnurl.substr(0,returnurl.length-1);
				}
				else
				{				
					arr = str.split('=');
										
					if (arr[0]==ref)
						return url.substr(0,url.indexOf('?'));
					else
						return url;
				}
				
				
			}
		</SCRIPT>
 </P>]]></description>
</item><item>
<title><![CDATA[C#淡出淡入窗体]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=18896</link>
<author>yjzhg</author>
<pubDate>2006/10/4 13:47:36</pubDate>
<description><![CDATA[<P>using System.Runtime.InteropServices;</P>
<P>
<P>public class Win32<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public const Int32 AW_HOR_POSITIVE = 0x00000001;&nbsp;&nbsp;&nbsp; // 从左到右打开窗口<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public const Int32 AW_HOR_NEGATIVE = 0x00000002;&nbsp;&nbsp;&nbsp; // 从右到左打开窗口<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public const Int32 AW_VER_POSITIVE = 0x00000004;&nbsp;&nbsp;&nbsp; // 从上到下打开窗口<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public const Int32 AW_VER_NEGATIVE = 0x00000008;&nbsp;&nbsp;&nbsp; // 从下到上打开窗口<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public const Int32 AW_CENTER = 0x00000010;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public const Int32 AW_HIDE = 0x00010000;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 在窗体卸载时若想使用本函数就得加上此常量<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public const Int32 AW_ACTIVATE = 0x00020000;&nbsp;&nbsp;&nbsp; //在窗体通过本函数打开后，默认情况下会失去焦点，除非加上本常量<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public const Int32 AW_SLIDE = 0x00040000;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public const Int32 AW_BLEND = 0x00080000;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 淡入淡出效果<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [DllImport("user32.dll", CharSet = CharSet.Auto)]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static extern bool AnimateWindow(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IntPtr hwnd,&nbsp; //&nbsp; handle&nbsp; to&nbsp; window&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int dwTime,&nbsp; //&nbsp; duration&nbsp; of&nbsp; animation&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int dwFlags&nbsp; //&nbsp; animation&nbsp; type&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</P>
<P>
<P>/*淡入窗体*/</P>
<P>private void Form_Load(object sender, EventArgs e)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Win32.AnimateWindow(this.Handle, 2000,&nbsp; Win32.AW_BLEND);<BR>}</P>
<P>
<P>/*淡出窗体*/</P>
<P>private void Form_FormClosing(object sender, FormClosingEventArgs e)<BR>{<BR>&nbsp;&nbsp;&nbsp; Win32.AnimateWindow(this.Handle, 2000, Win32.AW_SLIDE | Win32.AW_HIDE | Win32.AW_BLEND);<BR>}</P>]]></description>
</item><item>
<title><![CDATA[VSS 6 admin用户的密码破解]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=18069</link>
<author>yjzhg</author>
<pubDate>2006/9/4 11:17:51</pubDate>
<description><![CDATA[<DIV class=postTitle>the secret is to hack the um.dat file to remove the Admin password<BR><BR>from offset 80 the bytes are (all numbers are hex)<BR><BR>0:80&nbsp; 55 55 bc 7f 41 64 6d 69 6e 00 00 00 00 00 00 00<BR>0:90&nbsp; 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00<BR>0:a0&nbsp; 00 00 00 00 90 6e 00 00 a8 01 00 00 00 00 00 00<BR><BR>Just load the um.dat file into a hex editor and change the bytes from =<BR>offset 80 to exactly what is shown above. When the SourceSafe admin tool =<BR>starts it believes that the admin password has never been set.<BR><BR>the hex values above are taken from a 'virgin' um.dat file<BR><BR>of course, you didn't get this from me....and ALWAYS backup first (just =<BR>in case I'm wrong)<BR></DIV>
<DIV class=postText>
<DIV class=pgcontent>
<P>有朋友看不懂，我用中文解释一下：</P>
<P>如果忘记了密码，打开你vss数据库所在的文件夹，打开data目录，找到um.dat文件，用hex编辑器打开编辑它，从offset 80的55 55 开始将值改为如上文所述的样子，然后保存，这样um.dat文件就回到了初始状态(virgin ?&nbsp; <IMG src="http://messenger.msn.com/Resource/emoticons/regular_smile.gif">)，然后打开vss admin,用admin用户登录，不需要密码了！</P>
<P>&nbsp;</P>
<P>----------------------------------</P>
<P>转的，没试过</P></DIV></DIV>]]></description>
</item><item>
<title><![CDATA[没用过的东东(sql)]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=17638</link>
<author>yjzhg</author>
<pubDate>2006/8/18 16:28:42</pubDate>
<description><![CDATA[<P>B： EXCEPT 运算符 <BR>EXCEPT 运算符通过包括所有在 TABLE1 中但不在 TABLE2 中的行并消除所有重复行而派生出一个结果表。当 ALL 随 EXCEPT 一起使用时 (EXCEPT ALL)，不消除重复行。 <BR>C： INTERSECT 运算符<BR>INTERSECT 运算符通过只包括 TABLE1 和 TABLE2 中都有的行并消除所有重复行而派生出一个结果表。当 ALL 随 INTERSECT 一起使用时 (INTERSECT ALL)，不消除重复行。 <BR><BR>先去试试!</P>]]></description>
</item><item>
<title><![CDATA[初学ajax(C#)]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=17637</link>
<author>yjzhg</author>
<pubDate>2006/8/18 16:12:46</pubDate>
<description><![CDATA[
<P>&nbsp; 由于刚到新公司，事情并不是很多,无聊中看起了ajax，完全是初学，加上基础，看了半天才能看了解一点点皮毛，免得忘了一干二净，把还记得的东东，写下来吧！<BR><BR>&nbsp; Post数据:</P>
<P>h.html</P>
<P>----------------------------------------------------------</P>
<P>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt;<BR>&lt;HTML&gt;<BR>&lt;HEAD&gt;<BR>&lt;script language = "javascript"&gt;<BR>&nbsp;var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");<BR>&nbsp;var bloglist = new Array();</P>
<P>&nbsp;function StartLoad()<BR>&nbsp;{<BR>&nbsp;&nbsp;xmlhttp.open("POST","<A href="http://localhost:1034/WebSite_ForTest/Server.aspx">http://localhost:1034/WebSite_ForTest/Server.aspx</A>")<BR>&nbsp;&nbsp;xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")<BR>&nbsp;&nbsp;xmlhttp.onreadystatechange = function()<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if (xmlhttp.readystate == 4 &amp;&amp; xmlhttp.status == 200)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;alert(xmlhttp.responseText)<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;xmlhttp.send("ygergydsfgsdgsdfg");<BR>&nbsp;}</P>
<P>&lt;/script&gt;</P>
<P><BR>&lt;TITLE&gt; Post Data &lt;/TITLE&gt;</P>
<P>&lt;/HEAD&gt;</P>
<P>&lt;BODY onload="StartLoad()"&gt;</P>
<P>&lt;/BODY&gt;<BR>&lt;/HTML&gt;</P>
<P>----------------------------------------------------------------------</P>
<P>server.aspx</P>
<P>------------------------------------------------------------------</P>
<P>&nbsp;&nbsp;&nbsp; protected void Page_Load(object sender, EventArgs e)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string s = "";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; using (StreamReader sr = new StreamReader(Request.InputStream))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s = sr.ReadToEnd();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Write(s);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.End();<BR>&nbsp;&nbsp;&nbsp; }</P>
<P>------------------------------------------------------------------</P>
<P>Get：</P>
<P>————————————————————————————-————</P>
<P>&lt;html&gt;<BR>&lt;head runat="server"&gt;<BR>&lt;script language="javascript" type="text/javascript"&gt;<BR>&nbsp;&nbsp;&nbsp; var xmlhttp;<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; function createXMLHttpRequest()<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (window.ActiveXObject)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if(window.XMLHttpRequest)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlhttp = new XMLHttpRequest();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; function StartRequest()<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; createXMLHttpRequest();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlhttp.onreadystatechange = handleStateChange;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlhttp.open("GET","innerHTML.xml",true);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xmlhttp.send(null);<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; function handleStateChange()<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (xmlhttp.readystate == 4 &amp;&amp; xmlhttp.status == 200)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; document.getElementById("result").innerHTML = xmlhttp.responseText;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }<BR>&lt;/script&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;title&gt;无标题页&lt;/title&gt;<BR>&lt;/head&gt;<BR>&lt;body&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;form id="form1" runat="server"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;div id="result"&gt;&lt;/div&gt; <BR>&nbsp;&nbsp;&nbsp; &lt;div&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input type="button" value="ajax" onclick="StartRequest();" /&gt;&lt;/div&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/form&gt;<BR>&nbsp;&nbsp;&nbsp; <BR>&lt;/body&gt;<BR>&lt;/html&gt;<BR>————————————————————————————————</P>
<P>innerHTML.xml</P>
<P>-------------------------------------------------------------------</P>
<P>&lt;?xml version="1.0" encoding="utf-8" ?&gt;<BR>&lt;table border="1"&gt;<BR>&nbsp; &lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;td&gt;ss&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;td&gt;dd&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;td&gt;ff&lt;/td&gt;<BR>&nbsp; &lt;/tr&gt;<BR>&nbsp; &lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;td&gt;ff&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;td&gt;ff&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;td&gt;ff&lt;/td&gt;<BR>&nbsp; &lt;/tr&gt;<BR>&nbsp; &lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;td&gt;aa&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;td&gt;aa&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;td&gt;aa&lt;/td&gt;<BR>&nbsp; &lt;/tr&gt;<BR>&lt;/table&gt;</P>
<P>-------------------------------------------------------------------</P>]]></description>
</item><item>
<title><![CDATA[页面开发的准则一]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=17599</link>
<author>yjzhg</author>
<pubDate>2006/8/17 16:28:39</pubDate>
<description><![CDATA[<A></A>
<P>&nbsp; 结构(html,xhtml,xml..)</P>
<P>&nbsp; 表现(CSS,xslt..)</P>
<P>&nbsp; 行为(Dom,EcmaSCRIPT..)</P>
<P>&nbsp; 三种要素分离</P>]]></description>
</item><item>
<title><![CDATA[textbox忽略html验证]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=17513</link>
<author>yjzhg</author>
<pubDate>2006/8/14 11:24:29</pubDate>
<description><![CDATA[
<P>validateRequest="false"</P>
<P>asp.net</P>]]></description>
</item><item>
<title><![CDATA[这点破东东，老是记不住，nnd!]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=17509</link>
<author>yjzhg</author>
<pubDate>2006/8/14 11:00:46</pubDate>
<description><![CDATA[<A></A> 
<TABLE style="BACKGROUND-COLOR: #cccccc" cellSpacing=0 cellPadding=0 width="100%" border=1>
<TBODY>
<TR>
<TD>
<P>制表符</P></TD>
<TD>
<P><B>char(9)</B></P></TD></TR>
<TR>
<TD>
<P>换行符</P></TD>
<TD>
<P><B>char(10)</B></P></TD></TR>
<TR>
<TD>
<P>回车符</P></TD>
<TD>
<P><B>char(13)</B></P></TD></TR></TBODY></TABLE>]]></description>
</item><item>
<title><![CDATA[自动刷新页面的实现方法(Javascript)]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=17448</link>
<author>yjzhg</author>
<pubDate>2006/8/11 14:08:48</pubDate>
<description><![CDATA[
<P>1)<BR>&lt;meta http-equiv="refresh"content="10"&gt;<BR>10表示间隔10秒刷新一次<BR>2)<BR>&lt;script language=''javascript''&gt;<BR>window.location.reload(true);<BR>&lt;/script&gt;<BR>如果是你要刷新某一个iframe就把window给换成frame的名字或ID号<BR>3)<BR>&lt;script language=''javascript''&gt;<BR>window.navigate("本页面url");<BR>&lt;/script&gt;<BR></P>]]></description>
</item><item>
<title><![CDATA[操作excel的类]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=7987</link>
<author>yjzhg</author>
<pubDate>2005/8/24 11:44:19</pubDate>
<description><![CDATA[<P>using System;<BR>using System.Data;<BR>using System.Data.OleDb;<BR>using Excel;<BR>using System.Collections.Specialized;</P>
<P>namespace winapp_test<BR>{<BR>&nbsp;/// &lt;summary&gt;<BR>&nbsp;/// class_excel 的摘要说明。<BR>&nbsp;/// &lt;/summary&gt;<BR>&nbsp;public class class_excel<BR>&nbsp;{<BR>&nbsp;&nbsp;private string _filename;<BR>&nbsp;&nbsp;Excel.ApplicationClass app = new ApplicationClass();<BR>&nbsp;&nbsp;Excel.Workbook excel_wb;<BR>&nbsp;&nbsp;public class_excel(string f)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;//<BR>&nbsp;&nbsp;&nbsp;// TODO: 在此处添加构造函数逻辑<BR>&nbsp;&nbsp;&nbsp;//<BR>&nbsp;&nbsp;&nbsp;_filename = f;<BR>&nbsp;&nbsp;&nbsp;excel_wb = app.Workbooks.Open(_filename,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public StringCollection countexcel() //返回工作表名<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if(System.IO.File.Exists(_filename))<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;StringCollection a = new StringCollection();<BR>&nbsp;&nbsp;&nbsp;&nbsp;for(int i = 1;i&lt;=excel_wb.Worksheets.Count;i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a.Add(((Excel.Worksheet)excel_wb.Worksheets[i]).Name);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;return a;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;return null;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public DataSet proces() //用datset返回整个excel<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;string strConn&nbsp; = "Provider=Microsoft.Jet.OleDb.4.0;"; <BR>&nbsp;&nbsp;&nbsp;strConn += "data source=" + _filename + ";"; <BR>&nbsp;&nbsp;&nbsp;strConn += "Extended Properties=Excel 8.0;";&nbsp; <BR>&nbsp;&nbsp;&nbsp;strConn += "HDR=Yes;IMEX=1";<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;OleDbConnection objConn = new OleDbConnection(strConn);<BR>&nbsp;&nbsp;&nbsp;DataSet ds = new DataSet();<BR>&nbsp;&nbsp;&nbsp;OleDbDataAdapter oldda = new OleDbDataAdapter();</P>
<P>&nbsp;&nbsp;&nbsp;foreach(string sheetname in countexcel())<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;string a = "select * from ";<BR>&nbsp;&nbsp;&nbsp;&nbsp;a += sheetname;<BR>&nbsp;&nbsp;&nbsp;&nbsp;oldda.SelectCommand.CommandText = a;<BR>&nbsp;&nbsp;&nbsp;&nbsp;oldda.Fill(ds,sheetname);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;return ds;<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public int rowcount(string sheetname) //行数<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;return ((Excel.Worksheet)excel_wb.Worksheets.get_Item(sheetname)).UsedRange.Rows.Count;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;public int colcount(string sheetname) //列数<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;return ((Excel.Worksheet)excel_wb.Worksheets.get_Item(sheetname)).UsedRange.Columns.Count;<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public string range(string sheetname,int row,int col) //返回指定单元格的文本<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;Excel.Worksheet ws = (Excel.Worksheet)excel_wb.Worksheets.get_Item(sheetname);<BR>&nbsp;&nbsp;&nbsp;Excel.Range r = (Excel.Range)(ws.Cells[row,col]);<BR>&nbsp;&nbsp;&nbsp;return r.Text.ToString();<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public void close() //关闭<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;app.Workbooks.Close();<BR>&nbsp;&nbsp;&nbsp;app.Quit();<BR>&nbsp;&nbsp;&nbsp;app = null;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}</P>
<P>自己写的，水平实在有限</P>]]></description>
</item><item>
<title><![CDATA[C#中调用SQLSERVER DTS包的简单用法]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=7717</link>
<author>yjzhg</author>
<pubDate>2005/8/9 0:08:01</pubDate>
<description><![CDATA[<P>DTS.Package2Class p = new DTS.Package2Class();<BR>&nbsp;&nbsp;&nbsp;object t= null;<BR>&nbsp;&nbsp;&nbsp;p.LoadFromSQLServer(".","user","password",DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_Default,null,null,null,"pack1",ref t);</P>
<P>&nbsp;&nbsp; p.Execute();<BR>&nbsp;&nbsp;&nbsp;p.UnInitialize();<BR>&nbsp;&nbsp;&nbsp;p = null;<BR></P>]]></description>
</item><item>
<title><![CDATA[按正则式查找文本文件中所有符合的字符]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=7716</link>
<author>yjzhg</author>
<pubDate>2005/8/8 23:58:09</pubDate>
<description><![CDATA[<P>open1.Filter="文本文件(*.txt)|*.txt|所有文件|*.*";<BR>&nbsp;&nbsp;&nbsp;open1.ShowDialog();<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;if (open1.FileNames.Length &gt; 0)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;save1.Filter ="文本文件(*.txt)|*.txt|所有文件|*.*";<BR>&nbsp;&nbsp;&nbsp;&nbsp;save1.CreatePrompt = true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;save1.ShowDialog();<BR>&nbsp;&nbsp;&nbsp;&nbsp;if (save1.FileName != "")<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.IO.StreamWriter writer = new System.IO.StreamWriter(save1.FileName,false,System.Text.Encoding.Default);//也可指定GB2312<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach(string file in open1.FileNames)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;using(System.IO.StreamReader read = new System.IO.StreamReader(file,System.Text.Encoding.Default))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string line;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while((line = read.ReadLine()) != null)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (line.Length != 0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MatchCollection mc = Regex.Matches(line,"13{0-9}[9]");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach(Match m in mc)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writer.WriteLine(m.Value);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writer.Close();<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}</P>
<P>//自已要处理一些带手机号码的文本文件</P>]]></description>
</item><item>
<title><![CDATA[浅析SQL SERVER一个没有公开的存储过程]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=6585</link>
<author>yjzhg</author>
<pubDate>2005/6/15 23:58:00</pubDate>
<description><![CDATA[从SQLSERVER6.5开始，MS提供了一个非常有用的系统存储过程sp_MSforeachtable和sp_MSforeachDB；作为DBA会经常需要检查所有的数据库或用户表，比如：检查所有数据库的容量;看看指定数据库所有用户表的容量，所有表的记录数，我们一般处理这样的问题都是用游标分别处理处理，比如：在数据库检索效率非常慢时，我们想检查数据库所有的用户表，我们就必须这样写游标：
<P>DECLARE @TableName varchar（255）<BR>DECLARE @ExeSQL varchar（4000） <BR>DECLARE Table_Cursor CURSOR FOR SELECT [name] FROM sysobjects WHERE xtype='U'<BR>OPEN Table_Cursor<BR>FETCH NEXT FROM&nbsp; Table_Cursor INTO @TableName<BR>WHILE（@@FETCH_STATUS=0）<BR>BEGIN<BR>&nbsp;PRINT @TableName<BR>&nbsp;SELECT @ExeSQL='DBCC CHECKTABLE（<A href="mailto:'''+@TableName+'''">'''+@TableName+'''</A>）'<BR>&nbsp;EXEC（@EXESQL）<BR>FETCH NEXT FROM&nbsp; Table_Cursor INTO @TableName<BR>END<BR>CLOSE Table_Cursor<BR>DEALLOCATE Table_Cursor<BR>GO<BR>&nbsp;&nbsp;&nbsp; 如果我们用sp_MSforeachtable就可以非常方便的达到相同的目的:<BR>EXEC sp_MSforeachtable @command1=“print '?' DBCC CHECKTABLE（'?'）”</P>
<P>&nbsp;&nbsp;&nbsp; 大家可以看出这样就更加简洁（虽然在后台也是通过游标来处理的），下面我们就仔细分析一下sp_MSforeachtable这个存储过程：</P>
<P>&nbsp;&nbsp;&nbsp; 我们看看sp_MSforeachtable详细的CODE：<BR>USE MASTER <BR>GO<BR>SP_HELPTEXT sp_MSforeachtable<BR>--下面时sp_MSforeachtable的原始代码<BR>CREATE proc sp_MSforeachtable<BR>&nbsp;@command1 nvarchar（2000）， @replacechar nchar（1） = N'?'， @command2 nvarchar（2000） = null，<BR>&nbsp;&nbsp; @command3 nvarchar（2000） = null， @whereand nvarchar（2000） = null，<BR>&nbsp;@precommand nvarchar（2000） = null， @postcommand nvarchar（2000） = null<BR>as<BR>&nbsp;/* This proc returns one or more rows for each table （optionally， matching @where）， with each table defaulting to its <BR>own result set */<BR>&nbsp;/* @precommand and @postcommand may be used to force a single result set via a temp table。 */<BR>&nbsp;/* Preprocessor won't replace within quotes so have to use str（）。 */<BR>&nbsp;declare @mscat nvarchar（12）<BR>&nbsp;select @mscat = ltrim（str（convert（int， 0x0002）））<BR>&nbsp;if （@precommand is not null）<BR>&nbsp; exec（@precommand）<BR>&nbsp;/* Create the select */<BR>&nbsp;&nbsp; exec（N'declare hCForEach cursor global for select ''['' + REPLACE（user_name（uid）， N'']''， N'']]''） + '']'' + ''。'' + ''['' <BR>+ REPLACE（object_name（id）， N'']''， N'']]''） + '']'' from dbo。sysobjects o '<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + N' where OBJECTPROPERTY（o。id， N''IsUserTable''） = 1 ' + N' and o。category &amp; ' + @mscat + N' = 0 '<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + @whereand）<BR>&nbsp;declare @retval int<BR>&nbsp;select @retval = @@error<BR>&nbsp;if （@retval = 0）<BR>&nbsp; exec @retval = sp_MSforeach_worker @command1， @replacechar， @command2， @command3<BR>&nbsp;if （@retval = 0 and @postcommand is not null）<BR>&nbsp; exec（@postcommand）<BR>&nbsp;return @retval</P>
<P>这个系统存储过程有7个参数：</P>
<P>&nbsp;@command1 nvarchar（2000），&nbsp; --第一条运行的T-SQL指令<BR>&nbsp;@replacechar nchar（1） = N'?'，&nbsp;&nbsp; --指定的占位符号 <BR>&nbsp;@command2 nvarchar（2000） = null，--第二条运行的T-SQL指令<BR>&nbsp;&nbsp;&nbsp; @command3 nvarchar（2000） = null， --第三条运行的T-SQL指令<BR>&nbsp;@whereand nvarchar（2000） = null， --可选条件来选择表<BR>&nbsp;@precommand nvarchar（2000） = null， --在表前执行的指令<BR>&nbsp;@postcommand nvarchar（2000） = null --在表后执行的指令</P>
<P>所以上面的语句也可以这样写:</P>
<P>EXEC sp_MSforeachtable @command1=“print '?'”，<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @command2= “DBCC CHECKTABLE（'?'）”</P>
<P>&nbsp;&nbsp;&nbsp; 了解参数以后，就让我们做几个实列吧：</P>
<P>1。获得每个表的记录数和容量：</P>
<P>EXEC sp_MSforeachtable @command1=“print '?'“，<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @command2=“sp_spaceused '?'“，<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @command3= “SELECT count（*） FROM ? ”</P>
<P>2。更新PUBS数据库中已t开头的所有表的统计：</P>
<P>EXEC sp_MSforeachtable @whereand=“and name like 't%'”，<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @replacechar='*'，<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @precommand=“print 'Updating Statistics。。。。。' print ''”，<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @command1=“print '*' update statistics * “，<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @postcommand= “print''print 'Complete Update Statistics!'”</P>
<P>sp_MSforeachDB除了@whereand外，和sp_MSforeachtable的参数是一样的，我们可以通过这个存储过程检测所有的数据库，比如：</P>
<P>1。获得所有的数据库的存储空间：<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXEC sp_MSforeachdb&nbsp; @command1=“print '?'“，<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @command2=“sp_spaceused “<BR>2。检查所有的数据库<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXEC sp_MSforeachdb&nbsp; @command1=“print '?'“，<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @command2=“DBCC CHECKDB （?） “<BR>&nbsp;&nbsp;&nbsp; 有了上面的分析，我们可以建立自己的sp_MSforeachObject:</P>
<P>USE MASTER<BR>GO<BR>CREATE proc sp_MSforeachObject<BR>&nbsp;@objectType int=1，<BR>&nbsp;@command1 nvarchar（2000）， <BR>&nbsp;@replacechar nchar（1） = N'?'， <BR>&nbsp;@command2 nvarchar（2000） = null，<BR>&nbsp;&nbsp;&nbsp; @command3 nvarchar（2000） = null， <BR>&nbsp;@whereand nvarchar（2000） = null，<BR>&nbsp;@precommand nvarchar（2000） = null， <BR>&nbsp;@postcommand nvarchar（2000） = null<BR>as<BR>&nbsp;/* This proc returns one or more rows for each table （optionally， matching @where）， with each table defaulting to its <BR>own result set */<BR>&nbsp;/* @precommand and @postcommand may be used to force a single result set via a temp table。 */<BR>&nbsp;/* Preprocessor won't replace within quotes so have to use str（）。 */<BR>&nbsp;declare @mscat nvarchar（12）<BR>&nbsp;select @mscat = ltrim（str（convert（int， 0x0002）））<BR>&nbsp;if （@precommand is not null）<BR>&nbsp; exec（@precommand）<BR>&nbsp;/* Defined&nbsp; @isobject for save object type */<BR>&nbsp;Declare @isobject varchar（256）<BR>&nbsp;select @isobject= case @objectType when 1 then 'IsUserTable'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when 2 then 'IsView'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when 3 then 'IsTrigger'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when 4 then 'IsProcedure' <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when 5 then 'IsDefault'&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when 6 then 'IsForeignKey'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when 7 then 'IsScalarFunction'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when 8 then 'IsInlineFunction'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when 9 then 'IsPrimaryKey'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when 10 then 'IsExtendedProc'&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when 11 then 'IsReplProc'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; when 12 then 'IsRule'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<BR>&nbsp;/* Create the select */<BR>&nbsp;/* Use @isobject variable isstead of IsUserTable string */<BR>EXEC（N'declare hCForEach cursor global for select ''['' + REPLACE（user_name（uid）， N'']''， N'']]''） + '']'' + ''。'' + ''['' + <BR>REPLACE（object_name（id）， N'']''， N'']]''） + '']'' from dbo。sysobjects o '<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + N' where OBJECTPROPERTY（o。id， <A href="mailto:N'''+@isobject+'''">N'''+@isobject+'''</A>） = 1 '+N' and o。category &amp; ' + @mscat + N' = 0 '<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + @whereand）<BR>&nbsp;declare @retval int<BR>&nbsp;select @retval = @@error<BR>&nbsp;if （@retval = 0）<BR>&nbsp; exec @retval = sp_MSforeach_worker @command1， @replacechar， @command2， @command3<BR>&nbsp;if （@retval = 0 and @postcommand is not null）<BR>&nbsp; exec（@postcommand）<BR>&nbsp;return @retval<BR>GO</P>
<P>&nbsp;&nbsp;&nbsp; 这样我们来测试一下：</P>
<P>1。获得所有的存储过程的脚本：<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXEc sp_MSforeachObject @command1=“sp_helptext '?' “，@objectType=4</P>
<P>2。获得所有的视图的脚本：<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXEc sp_MSforeachObject @command1=“sp_helptext '?' “，@objectType=2</P>
<P>3。比如在开发过程中，没一个用户都是自己的OBJECT OWNER，所以在真实的数据库时都要改为DBO：<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXEc sp_MSforeachObject @command1=“sp_changeobjectowner '?'， 'dbo'“，@objectType=1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXEc sp_MSforeachObject @command1=“sp_changeobjectowner '?'， 'dbo'“，@objectType=2<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXEc sp_MSforeachObject @command1=“sp_changeobjectowner '?'， 'dbo'“，@objectType=3<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXEc sp_MSforeachObject @command1=“sp_changeobjectowner '?'， 'dbo'“，@objectType=4</P>
<P>&nbsp;&nbsp;&nbsp; 这样就非常方便的将每一个数据库对象改为DBO。</P>
<P>&nbsp;&nbsp;&nbsp; 当然还要很多非常好的功能，大家可以自己深入研究吧</P>]]></description>
</item><item>
<title><![CDATA[sqlxml中的EXPLICIT模式]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=6584</link>
<author>yjzhg</author>
<pubDate>2005/6/15 23:42:28</pubDate>
<description><![CDATA[
<P>use pubs</P>
<P>select 1 as tag,null as parent,stor_id as [aa!1!d],ord_num as [aa!1] from sales for xml explicit</P>
<P>简单举例，</P>
<P>具体看sql帮助explicit模式</P>]]></description>
</item><item>
<title><![CDATA[kill进程]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=4884</link>
<author>yjzhg</author>
<pubDate>2005/4/12 11:45:53</pubDate>
<description><![CDATA[<P>using System.Diagnostics;</P>
<P>....&nbsp;&nbsp;&nbsp;</P>
<P>try<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;foreach (Process thisproc in Process.GetProcessesByName("Excel")) <BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!thisproc.CloseMainWindow())<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;thisproc.Kill();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;catch(Exception Exc)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;MessageBox.Show("杀死Excel失败！ " + Exc.Message);<BR>&nbsp;&nbsp;&nbsp;}</P>]]></description>
</item><item>
<title><![CDATA[excel中的工作表名sheetname]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=4866</link>
<author>yjzhg</author>
<pubDate>2005/4/11 23:49:25</pubDate>
<description><![CDATA[<P>　Excel.ApplicationClass exa = new Excel.ApplicationClass();<BR>&nbsp;&nbsp;&nbsp;Excel.Workbooks wbs = exa.Workbooks;<BR>&nbsp;&nbsp;&nbsp;Excel.Workbook wb = wbs.Open(@"E:\1\aa.xls",Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing);</P>
<P>&nbsp;&nbsp;&nbsp;for (int i = 1; i&lt;=wb.Worksheets.Count;i++)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;MessageBox.Show(((Excel.Worksheet)wb.Worksheets[i]).Name);<BR>&nbsp;&nbsp;&nbsp;}</P>]]></description>
</item><item>
<title><![CDATA[ini文件操作]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=4840</link>
<author>yjzhg</author>
<pubDate>2005/4/11 13:17:13</pubDate>
<description><![CDATA[<P>using System;<BR>using System.IO;<BR>using System.Runtime.InteropServices;<BR>using System.Text;</P>
<P>&nbsp;public class inifile<BR>&nbsp;{<BR>&nbsp;&nbsp;public string Path;<BR>&nbsp;&nbsp;[DllImport("kernel32")]<BR>&nbsp;&nbsp;private static extern long WritePrivateProfileString(string section,string key,string val,string filePath);<BR>&nbsp;&nbsp;[DllImport("kernel32")]<BR>&nbsp;&nbsp;private static extern int GetPrivateProfileString(string section,string key,string def,StringBuilder retVal,int size,string filePath);</P>
<P>&nbsp;&nbsp;public inifile(string filename)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;//<BR>&nbsp;&nbsp;&nbsp;// TODO: 在此处添加构造函数逻辑<BR>&nbsp;&nbsp;&nbsp;//<BR>&nbsp;&nbsp;&nbsp;Path = filename;<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public void IniWriteValue(string Section,string Key,string Value)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;WritePrivateProfileString(Section,Key,Value,this.Path);<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public string IniReadValue(string Section,string Key)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;StringBuilder temp = new StringBuilder(255);<BR>&nbsp;&nbsp;&nbsp;int i = GetPrivateProfileString(Section,Key,"",temp,255,this.Path);<BR>&nbsp;&nbsp;&nbsp;return temp.ToString();<BR>&nbsp;&nbsp;}<BR>&nbsp;}</P>]]></description>
</item><item>
<title><![CDATA[遍历目录下的所有文件]]></title>
<link>http://blogger.org.cn/blog/more.asp?name=yjzhg&amp;id=4700</link>
<author>yjzhg</author>
<pubDate>2005/4/8 10:02:09</pubDate>
<description><![CDATA[private void button1_Click(object sender, System.EventArgs e)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;folderBrowserDialog1.ShowDialog();<BR>&nbsp;&nbsp;&nbsp;if (folderBrowserDialog1.SelectedPath !="")<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;StringCollection sc =getallfiles(folderBrowserDialog1.SelectedPath);
<P>&nbsp;&nbsp;&nbsp;&nbsp;for(int i = 0;i&lt;sc.Count;i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MessageBox.Show(sc[i]);//得到所有的文件名</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else<BR>&nbsp;&nbsp;&nbsp;&nbsp;return;</P>
<P>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public System.Collections.Specialized.StringCollection getallfiles(string rootdir)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;StringCollection result = new StringCollection();</P>
<P>&nbsp;&nbsp;&nbsp;getfiles(rootdir,result);<BR>&nbsp;&nbsp;&nbsp;return result;<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public void getfiles(string parentdir,StringCollection r)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;string[] dir = System.IO.Directory.GetDirectories(parentdir);</P>
<P>&nbsp;&nbsp;&nbsp;for (int i = 0;i&lt;dir.Length;i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;getfiles(dir[i],r);</P>
<P>&nbsp;&nbsp;&nbsp;string[] file= System.IO.Directory.GetFiles(parentdir);<BR>&nbsp;&nbsp;&nbsp;for(int i = 0;i&lt;file.Length;i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;r.Add(file[i]);<BR>&nbsp;&nbsp;}</P>]]></description>
</item>
</channel>
</rss>