﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-思想者-文章分类-.Net technology</title><link>http://www.blogjava.net/Microhelp/category/1816.html</link><description>君子博学而日参省乎己，则智明而行无过也。</description><language>zh-cn</language><lastBuildDate>Tue, 13 May 2008 05:57:18 GMT</lastBuildDate><pubDate>Tue, 13 May 2008 05:57:18 GMT</pubDate><ttl>60</ttl><item><title>在asp.net中xmlHttp.responseText的返回值全部是html代码,怎样才能只返回我Response.write的内容</title><link>http://www.blogjava.net/Microhelp/articles/200144.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Tue, 13 May 2008 02:35:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/200144.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/200144.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/200144.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/200144.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/200144.html</trackback:ping><description><![CDATA[<p>今天在看ASP.NET AJAX程序设计的时候做第一个例子，用XMLHttpRequest对象异步发送请求，在aspx页面的pageload页面处理之后用Response.Write方法返回处理之后的值。在页面上用var isValid = xmlHttp.responseText 获得response的内容的时候，发现内容后面跟了很多html的内容。我只想获得我response的内容。处理方法为：在aspx页面上删除除了第一句也就是&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="FMT.test" %&gt;之外的所有内容。或者像原来的例子一样直接写在页面里面，不要把写在分开的cs文件里。例如：<br />
<br />
</p>
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img id="Codehighlighter1_2_22_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2_22_Open_Text.style.display='none'; Codehighlighter1_2_22_Closed_Image.style.display='inline'; Codehighlighter1_2_22_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_2_22_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_2_22_Closed_Text.style.display='none'; Codehighlighter1_2_22_Open_Image.style.display='inline'; Codehighlighter1_2_22_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top"  alt="" /><span style="color: #000000; background-color: #ffff00">&lt;%</span><span id="Codehighlighter1_2_22_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_2_22_Open_Text"><span style="color: #000000; background-color: #f5f5f5">@&nbsp;Page&nbsp;Language</span><span style="color: #000000; background-color: #f5f5f5">=</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">C#</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">&nbsp;</span></span><span style="color: #000000; background-color: #ffff00">%&gt;</span><span style="color: #000000"><br />
<img id="Codehighlighter1_49_524_Open_Image" onclick="this.style.display='none'; Codehighlighter1_49_524_Open_Text.style.display='none'; Codehighlighter1_49_524_Closed_Image.style.display='inline'; Codehighlighter1_49_524_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_49_524_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_49_524_Closed_Text.style.display='none'; Codehighlighter1_49_524_Open_Image.style.display='inline'; Codehighlighter1_49_524_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top"  alt="" /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">script&nbsp;</span><span style="color: #ff0000">runat</span><span style="color: #0000ff">="server"</span><span style="color: #0000ff">&gt;</span><span id="Codehighlighter1_49_524_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_49_524_Open_Text"><span style="color: #000000; background-color: #f5f5f5"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;protected&nbsp;</span><span style="color: #0000ff; background-color: #f5f5f5">void</span><span style="color: #000000; background-color: #f5f5f5">&nbsp;Page_Load(object&nbsp;sender,&nbsp;EventArgs&nbsp;e)<br />
<img id="Codehighlighter1_111_523_Open_Image" onclick="this.style.display='none'; Codehighlighter1_111_523_Open_Text.style.display='none'; Codehighlighter1_111_523_Closed_Image.style.display='inline'; Codehighlighter1_111_523_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_111_523_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_111_523_Closed_Text.style.display='none'; Codehighlighter1_111_523_Open_Image.style.display='inline'; Codehighlighter1_111_523_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_111_523_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_111_523_Open_Text"><span style="color: #000000; background-color: #f5f5f5">{<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; background-color: #f5f5f5">//</span><span style="color: #008000; background-color: #f5f5f5">&nbsp;get&nbsp;the&nbsp;candidate&nbsp;user&nbsp;name.</span><span style="color: #008000; background-color: #f5f5f5"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000; background-color: #f5f5f5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string&nbsp;candidateUserName&nbsp;</span><span style="color: #000000; background-color: #f5f5f5">=</span><span style="color: #000000; background-color: #f5f5f5">&nbsp;Request[</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">UserName</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">];<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; background-color: #f5f5f5">//</span><span style="color: #008000; background-color: #f5f5f5">&nbsp;validate</span><span style="color: #008000; background-color: #f5f5f5"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000; background-color: #f5f5f5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bool&nbsp;isValid&nbsp;</span><span style="color: #000000; background-color: #f5f5f5">=</span><span style="color: #000000; background-color: #f5f5f5">&nbsp;</span><span style="color: #0000ff; background-color: #f5f5f5">false</span><span style="color: #000000; background-color: #f5f5f5">;<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff; background-color: #f5f5f5">if</span><span style="color: #000000; background-color: #f5f5f5">&nbsp;(candidateUserName.ToLower()&nbsp;</span><span style="color: #000000; background-color: #f5f5f5">!=</span><span style="color: #000000; background-color: #f5f5f5">&nbsp;</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">dflying</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">)<br />
<img id="Codehighlighter1_330_368_Open_Image" onclick="this.style.display='none'; Codehighlighter1_330_368_Open_Text.style.display='none'; Codehighlighter1_330_368_Closed_Image.style.display='inline'; Codehighlighter1_330_368_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"  alt="" /><img id="Codehighlighter1_330_368_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_330_368_Closed_Text.style.display='none'; Codehighlighter1_330_368_Open_Image.style.display='inline'; Codehighlighter1_330_368_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span id="Codehighlighter1_330_368_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.blogjava.net/Images/dot.gif"  alt="" /></span><span id="Codehighlighter1_330_368_Open_Text"><span style="color: #000000; background-color: #f5f5f5">{<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;isValid&nbsp;</span><span style="color: #000000; background-color: #f5f5f5">=</span><span style="color: #000000; background-color: #f5f5f5">&nbsp;</span><span style="color: #0000ff; background-color: #f5f5f5">true</span><span style="color: #000000; background-color: #f5f5f5">;<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000; background-color: #f5f5f5"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; background-color: #f5f5f5">//</span><span style="color: #008000; background-color: #f5f5f5">&nbsp;send&nbsp;out&nbsp;result</span><span style="color: #008000; background-color: #f5f5f5"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" /></span><span style="color: #000000; background-color: #f5f5f5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.Clear();<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.Write(isValid&nbsp;</span><span style="color: #000000; background-color: #f5f5f5">?</span><span style="color: #000000; background-color: #f5f5f5">&nbsp;</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">true</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">&nbsp;:&nbsp;</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">false</span><span style="color: #000000; background-color: #f5f5f5">"</span><span style="color: #000000; background-color: #f5f5f5">);<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.Flush();<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000; background-color: #f5f5f5"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span></span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />
<img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top"  alt="" /></span></div>
<img src ="http://www.blogjava.net/Microhelp/aggbug/200144.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2008-05-13 10:35 <a href="http://www.blogjava.net/Microhelp/articles/200144.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>使用Visual Studio.net调试javascript最方便的方法 </title><link>http://www.blogjava.net/Microhelp/articles/200042.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Mon, 12 May 2008 08:22:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/200042.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/200042.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/200042.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/200042.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/200042.html</trackback:ping><description><![CDATA[<h2>&nbsp;</h2>
好久不上来写东西了，前一阵子发现一个使用VS.net调试javascript的简便方法，比起以前附加IE进程的做法方便多了，做法如下：首先在IE选项-》高级，将禁止脚本调试去掉。然后在需要调试的页面的脚本中加上debugger; 然后运行这个页面，就会在这里停下来，下一步怎么做大家应该很熟悉了吧？<br />
例如：<br />
function BtnSubmit_Click()<br />
{<br />
&nbsp;&nbsp;&nbsp; var aaa;<br />
&nbsp;&nbsp;&nbsp; aaa='aaa';<br />
&nbsp;<span style="background-color: yellow">&nbsp;&nbsp; debugger;&nbsp;&nbsp;&nbsp;//运行到这会停下来<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;alert(aaa);<br />
&nbsp; <br />
} 
<img src ="http://www.blogjava.net/Microhelp/aggbug/200042.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2008-05-12 16:22 <a href="http://www.blogjava.net/Microhelp/articles/200042.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Vs2005中使用Ajax(二)</title><link>http://www.blogjava.net/Microhelp/articles/147114.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Fri, 21 Sep 2007 06:53:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/147114.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/147114.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/147114.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/147114.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/147114.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp; 1．&nbsp; 这里要做的是一个省市区三级联动的下拉列表框，效果如下图。在前面的项目中，新建页面AjaxForm2.aspx，添加三个DropdownList，添加一个textbox和一个button&lt;table&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &l...&nbsp;&nbsp;<a href='http://www.blogjava.net/Microhelp/articles/147114.html'>阅读全文</a><img src ="http://www.blogjava.net/Microhelp/aggbug/147114.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2007-09-21 14:53 <a href="http://www.blogjava.net/Microhelp/articles/147114.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WebService中如何使用soapheader</title><link>http://www.blogjava.net/Microhelp/articles/26307.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Mon, 02 Jan 2006 01:57:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/26307.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/26307.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/26307.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/26307.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/26307.html</trackback:ping><description><![CDATA[<P>1. 首先需要在服务中定义一个从 SOAPHeader 派生的类,表示传入 SOAP 标头的数据.<BR>public class SecurityHeader: System.Web.Services.Protocols.SoapHeader<BR>&nbsp;{<BR>&nbsp;&nbsp;&nbsp; &nbsp;public string userName;<BR>&nbsp;&nbsp;&nbsp; &nbsp;public string passWord;<BR>&nbsp;&nbsp;&nbsp; &nbsp;public string key;</P>
<P>&nbsp;&nbsp;&nbsp; &nbsp;public SecurityHeader()<BR>&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;}<BR>2. 将SecurityHeader类作为webservice类的一个属性公开,并在WebMethod里使用SecurityHeader<BR>&nbsp;&nbsp;&nbsp; 这样就允许客户使用这个SoapHeader了。<BR>public class Map : System.Web.Services.WebService<BR>&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public SecurityHeader keyHeader;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public Map()<BR>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;[WebMethod,SoapHeader("keyHeader")]<BR>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;public string HelloWorld()<BR>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //这里我们可以获得客户传来的header值按需要做验证等处理<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string keyValue = keyHeader.key ;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;return keyValue;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>}<BR><BR>客户端使用SoapHeader的方法如下（调用之前先声明webreference MapClient）：<BR>&nbsp; MapService.MapClient.SecurityHeader header = new MapService.MapClient.SecurityHeader();<BR>&nbsp;&nbsp;&nbsp;header.userName = "userName";<BR>&nbsp;&nbsp;&nbsp;header.passWord = "passWord";<BR>&nbsp;&nbsp;&nbsp;header.key = "Hello,this is a key....";</P>
<P>&nbsp;&nbsp;&nbsp;MapClient.Map testClient = new MapService.MapClient.Map();<BR>&nbsp;&nbsp;&nbsp;testClient.SecurityHeaderValue = header;<BR>&nbsp;&nbsp;&nbsp;testClient.Credentials = System.Net.CredentialCache.DefaultCredentials; <BR>&nbsp;&nbsp;&nbsp;string ss = testClient.HelloWorld();</P><img src ="http://www.blogjava.net/Microhelp/aggbug/26307.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2006-01-02 09:57 <a href="http://www.blogjava.net/Microhelp/articles/26307.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>RSS是什么</title><link>http://www.blogjava.net/Microhelp/articles/22511.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Mon, 05 Dec 2005 02:40:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/22511.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/22511.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/22511.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/22511.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/22511.html</trackback:ping><description><![CDATA[■　名词解释<BR><BR>　　RSS是什么？听说过的不在少数，但能说得清、玩得转的的确不多。RSS究竟代表什么呢？比较普遍的有两种说法，一种是“Rich　Site　Summary”(丰富站点摘要)或“RDF　Site　Summary”(RDF站点摘要)，另一种是“Really　Simple　Syndication”(真正简易聚合)。<BR><BR>　　■　链接<BR><BR>　　RSS之前世今生发源与标准之争<BR><BR>　　●1997年，网景公司(Netscape)设计开发出最初的RSS　0.90版本<BR><BR>　　●2000年，软件公司UserLand接手RSS　0.91版本的发展，并将其发展为博客写作的基础软件，陆续推出了0.92、0.93和0.94版本<BR><BR>　　●2001年，一个第三方，非商业组织将RSS重新定义为“RDF　Site　Summary”，并发布RSS　1.0<BR><BR>　　●2002年，UserLand公司又将RSS再定义为“Really　Simple　Syndication”，并发布RSS　2.0<BR><BR>　　●2003年，RSS分化为RSS　0.9x／2.0和RSS　1.0两个阵营，RSS迄今没有一个统一的标准<BR><BR>　　●2005年，微软申请XML文件(RSS生成文件)标准专利遭拒<BR><img src ="http://www.blogjava.net/Microhelp/aggbug/22511.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-12-05 10:40 <a href="http://www.blogjava.net/Microhelp/articles/22511.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用户控件与服务器控件(三)</title><link>http://www.blogjava.net/Microhelp/articles/19168.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Thu, 10 Nov 2005 07:33:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/19168.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/19168.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/19168.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/19168.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/19168.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 创作简单的 ASP.NET 服务器控件参见: http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpguide/html/cpconwalkthroughdevelopingsimplewebformscontrol.asp1.&nbsp; 定义一个直接或间接从 System.Web.UI.Control ...&nbsp;&nbsp;<a href='http://www.blogjava.net/Microhelp/articles/19168.html'>阅读全文</a><img src ="http://www.blogjava.net/Microhelp/aggbug/19168.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-11-10 15:33 <a href="http://www.blogjava.net/Microhelp/articles/19168.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用户控件与服务器控件(一)</title><link>http://www.blogjava.net/Microhelp/articles/19166.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Thu, 10 Nov 2005 07:31:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/19166.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/19166.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/19166.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/19166.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/19166.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 6pt 0cm; LINE-HEIGHT: 18pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-outline-level: 1" align=left><A name=cpconcontrolexecutionlifecycle></A><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">用户控件与服务器控件</SPAN></B><B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US style="FONT-SIZE: 12pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 6pt 0cm; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-line-height-alt: 0pt" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">用户控件继承于<SPAN lang=EN-US>System.Web.UI.UserControl</SPAN>类<SPAN lang=EN-US>,</SPAN>保存为<SPAN lang=EN-US>ascx</SPAN>文件<SPAN lang=EN-US>.</SPAN>创建方法参见<SPAN lang=EN-US>:</SPAN></SPAN><SPAN lang=EN-US> </SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><A href="http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpguide/html/cpconwebformsusercontrols.asp">http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpguide/html/cpconwebformsusercontrols.asp</A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 6pt 0cm; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-line-height-alt: 0pt" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">服务器控件继承于<SPAN lang=EN-US>Control</SPAN>类<SPAN lang=EN-US>, </SPAN>保存为<SPAN lang=EN-US>CS</SPAN>文件<SPAN lang=EN-US>. </SPAN>创建方法参见<SPAN lang=EN-US>:</SPAN></SPAN><SPAN lang=EN-US> </SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><A href="http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpguide/html/cpconwebformscontroldevelopmentbasics.asp">http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpguide/html/cpconwebformscontroldevelopmentbasics.asp</A><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 6pt 0cm; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-line-height-alt: 0pt" align=left><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p>&nbsp;</o:p></SPAN></P>
<P class=MsoNormal style="BACKGROUND: #99ccff; MARGIN: 0cm 0cm 2.4pt 0.1pt; TEXT-INDENT: -4.5pt; TEXT-ALIGN: left; mso-pagination: widow-orphan; mso-outline-level: 2; mso-para-margin-top: 0cm; mso-para-margin-right: 0cm; mso-para-margin-bottom: 2.4pt; mso-para-margin-left: -.42gd; mso-char-indent-count: -.47" align=left><A name=cpconcompositecontrolvsusercontrol></A><B><SPAN style="FONT-SIZE: 9.5pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 18.0pt">复合控件与用户控件</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 9.5pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 18.0pt"><o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 6pt 0cm; LINE-HEIGHT: 18pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">下表汇总了复合控件与用户控件之间的差异。有关创作用户控件的详细信息，请参见</SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> <SPAN lang=EN-US><A href="http://msdn.microsoft.com/library/CHS/cpguide/html/cpconwebformsusercontrols.asp">Web <SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana"><SPAN lang=EN-US>窗体用户控件</SPAN></SPAN></A></SPAN></SPAN><SPAN style="FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 8pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P>
<TABLE class=MsoNormalTable style="BORDER-RIGHT: #999999 1pt solid; BORDER-TOP: #999999 1pt solid; BACKGROUND: #999999; BORDER-LEFT: #999999 1pt solid; WIDTH: 100%; BORDER-BOTTOM: #999999 1pt solid; mso-cellspacing: 0cm; mso-border-top-alt: .75pt; mso-border-left-alt: .25pt; mso-border-bottom-alt: .25pt; mso-border-right-alt: .75pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" cellSpacing=0 cellPadding=0 width="100%" border=1>
<TBODY>
<TR style="mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD style="BORDER-RIGHT: #999999 1pt solid; PADDING-RIGHT: 4.5pt; BORDER-TOP: #999999 1pt solid; PADDING-LEFT: 4.5pt; BACKGROUND: #cccccc; PADDING-BOTTOM: 3pt; BORDER-LEFT: #999999 1pt solid; WIDTH: 50%; PADDING-TOP: 3pt; BORDER-BOTTOM: #999999 1pt solid; mso-border-top-alt: .25pt; mso-border-left-alt: .75pt; mso-border-bottom-alt: .75pt; mso-border-right-alt: .25pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" vAlign=bottom width="50%">
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><B><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">复合控件</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></B></P></TD>
<TD style="BORDER-RIGHT: #999999 1pt solid; PADDING-RIGHT: 4.5pt; BORDER-TOP: #999999 1pt solid; PADDING-LEFT: 4.5pt; BACKGROUND: #cccccc; PADDING-BOTTOM: 3pt; BORDER-LEFT: #999999 1pt solid; WIDTH: 50%; PADDING-TOP: 3pt; BORDER-BOTTOM: #999999 1pt solid; mso-border-top-alt: .25pt; mso-border-left-alt: .75pt; mso-border-bottom-alt: .75pt; mso-border-right-alt: .25pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" vAlign=bottom width="50%">
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><B><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">用户控件</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></B></P></TD></TR>
<TR style="mso-yfti-irow: 1">
<TD style="BORDER-RIGHT: #999999 1pt solid; PADDING-RIGHT: 4.5pt; BORDER-TOP: #999999 1pt solid; PADDING-LEFT: 4.5pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #999999 1pt solid; WIDTH: 50%; PADDING-TOP: 3pt; BORDER-BOTTOM: #999999 1pt solid; mso-border-top-alt: .25pt; mso-border-left-alt: .75pt; mso-border-bottom-alt: .75pt; mso-border-right-alt: .25pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" vAlign=top width="50%">
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">创作的最短设计时支持。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: #999999 1pt solid; PADDING-RIGHT: 4.5pt; BORDER-TOP: #999999 1pt solid; PADDING-LEFT: 4.5pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #999999 1pt solid; WIDTH: 50%; PADDING-TOP: 3pt; BORDER-BOTTOM: #999999 1pt solid; mso-border-top-alt: .25pt; mso-border-left-alt: .75pt; mso-border-bottom-alt: .75pt; mso-border-right-alt: .25pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" vAlign=top width="50%">
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">创作的完全设计时支持。在可视化设计器中，创作用户控件与创作</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> ASP.NET </SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">页（</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">“Web </SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">窗体</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">”</SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">页）没有差别。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 2">
<TD style="BORDER-RIGHT: #999999 1pt solid; PADDING-RIGHT: 4.5pt; BORDER-TOP: #999999 1pt solid; PADDING-LEFT: 4.5pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #999999 1pt solid; WIDTH: 50%; PADDING-TOP: 3pt; BORDER-BOTTOM: #999999 1pt solid; mso-border-top-alt: .25pt; mso-border-left-alt: .75pt; mso-border-bottom-alt: .75pt; mso-border-right-alt: .25pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" vAlign=top width="50%">
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">以目标为公共语言运行库的面向对象的编程语言，如</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> C# </SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">或</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> Visual Basic .NET</SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">，是用编程方式创作的。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: #999999 1pt solid; PADDING-RIGHT: 4.5pt; BORDER-TOP: #999999 1pt solid; PADDING-LEFT: 4.5pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #999999 1pt solid; WIDTH: 50%; PADDING-TOP: 3pt; BORDER-BOTTOM: #999999 1pt solid; mso-border-top-alt: .25pt; mso-border-left-alt: .75pt; mso-border-bottom-alt: .75pt; mso-border-right-alt: .25pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" vAlign=top width="50%">
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">使用</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> ASP.NET </SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">页语法和脚本块（或代码隐藏页）声明性地创作的。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><B><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">注意</SPAN></B><B><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">&nbsp;&nbsp;&nbsp;</SPAN></B><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">用于创作脚本块的语言是针对公共语言运行库的面向对象的语言，如</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> C#</SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">、</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">Visual Basic .NET </SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">和</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> JScript .NET</SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">；但是</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> ASP.NET </SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">页框架会向开发人员隐藏许多编程细节。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 3">
<TD style="BORDER-RIGHT: #999999 1pt solid; PADDING-RIGHT: 4.5pt; BORDER-TOP: #999999 1pt solid; PADDING-LEFT: 4.5pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #999999 1pt solid; WIDTH: 50%; PADDING-TOP: 3pt; BORDER-BOTTOM: #999999 1pt solid; mso-border-top-alt: .25pt; mso-border-left-alt: .75pt; mso-border-bottom-alt: .75pt; mso-border-right-alt: .25pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" vAlign=top width="50%">
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">作为程序集</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> (.dll) </SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">编译和保持的。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: #999999 1pt solid; PADDING-RIGHT: 4.5pt; BORDER-TOP: #999999 1pt solid; PADDING-LEFT: 4.5pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #999999 1pt solid; WIDTH: 50%; PADDING-TOP: 3pt; BORDER-BOTTOM: #999999 1pt solid; mso-border-top-alt: .25pt; mso-border-left-alt: .75pt; mso-border-bottom-alt: .75pt; mso-border-right-alt: .25pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" vAlign=top width="50%">
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">另存为带有</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"> .ascx </SPAN><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">扩展名的文本文件（带有可选的代码隐藏文件）。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 4">
<TD style="BORDER-RIGHT: #999999 1pt solid; PADDING-RIGHT: 4.5pt; BORDER-TOP: #999999 1pt solid; PADDING-LEFT: 4.5pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #999999 1pt solid; WIDTH: 50%; PADDING-TOP: 3pt; BORDER-BOTTOM: #999999 1pt solid; mso-border-top-alt: .25pt; mso-border-left-alt: .75pt; mso-border-bottom-alt: .75pt; mso-border-right-alt: .25pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" vAlign=top width="50%">
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">非常适于创作一般的可重新发布的控件。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: #999999 1pt solid; PADDING-RIGHT: 4.5pt; BORDER-TOP: #999999 1pt solid; PADDING-LEFT: 4.5pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #999999 1pt solid; WIDTH: 50%; PADDING-TOP: 3pt; BORDER-BOTTOM: #999999 1pt solid; mso-border-top-alt: .25pt; mso-border-left-alt: .75pt; mso-border-bottom-alt: .75pt; mso-border-right-alt: .25pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" vAlign=top width="50%">
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">适合应用程序特定的功能。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P></TD></TR>
<TR style="mso-yfti-irow: 5; mso-yfti-lastrow: yes">
<TD style="BORDER-RIGHT: #999999 1pt solid; PADDING-RIGHT: 4.5pt; BORDER-TOP: #999999 1pt solid; PADDING-LEFT: 4.5pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #999999 1pt solid; WIDTH: 50%; PADDING-TOP: 3pt; BORDER-BOTTOM: #999999 1pt solid; mso-border-top-alt: .25pt; mso-border-left-alt: .75pt; mso-border-bottom-alt: .75pt; mso-border-right-alt: .25pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" vAlign=top width="50%">
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">设计时宿主中使用时的完全设计时支持。可以将复合控件添加到可视化设计器的工具箱并拖放到页上。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P></TD>
<TD style="BORDER-RIGHT: #999999 1pt solid; PADDING-RIGHT: 4.5pt; BORDER-TOP: #999999 1pt solid; PADDING-LEFT: 4.5pt; BACKGROUND: white; PADDING-BOTTOM: 3pt; BORDER-LEFT: #999999 1pt solid; WIDTH: 50%; PADDING-TOP: 3pt; BORDER-BOTTOM: #999999 1pt solid; mso-border-top-alt: .25pt; mso-border-left-alt: .75pt; mso-border-bottom-alt: .75pt; mso-border-right-alt: .25pt; mso-border-color-alt: #999999; mso-border-style-alt: solid" vAlign=top width="50%">
<P class=MsoNormal style="MARGIN: 7.2pt 0cm 3.6pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 宋体; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">设计器中的最小使用支持。</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt"><o:p></o:p></SPAN></P></TD></TR></TBODY></TABLE><img src ="http://www.blogjava.net/Microhelp/aggbug/19166.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-11-10 15:31 <a href="http://www.blogjava.net/Microhelp/articles/19166.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用户控件与服务器控件(二)</title><link>http://www.blogjava.net/Microhelp/articles/19167.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Thu, 10 Nov 2005 07:31:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/19167.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/19167.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/19167.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/19167.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/19167.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 服务器控件控件执行生命周期每次请求 ASP.NET 页时，服务器就会加载一个 ASP.NET 页，并在请求完成时卸载该页。页及其包含的服务器控件负责执行请求并将 HTML 呈现给客户端。虽然客户端和服务器之间的通信是无状态的和断续的，但是必须使客户感觉到这是一个连续执行的过程。这种连续性假象是由 ASP.NET 页框架、页及其控件实现的。回发后，控件的行为必须看起来是从上次 Web 请...&nbsp;&nbsp;<a href='http://www.blogjava.net/Microhelp/articles/19167.html'>阅读全文</a><img src ="http://www.blogjava.net/Microhelp/aggbug/19167.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-11-10 15:31 <a href="http://www.blogjava.net/Microhelp/articles/19167.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET配置文件Web.config</title><link>http://www.blogjava.net/Microhelp/articles/17839.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Wed, 02 Nov 2005 08:39:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/17839.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/17839.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/17839.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/17839.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/17839.html</trackback:ping><description><![CDATA[<TABLE cellSpacing=0 cellPadding=0 width="97%" align=center border=0>
<TBODY>
<TR>
<TD colSpan=2 height=11>
<P align=center><B>ASP.NET配置文件Web.config </B><BR><BR><FONT color=#666666 size=2>《长城在线》</FONT> <FONT color=#666666>2005-1-19 17:06:04</FONT> </P></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="97%" align=center border=0>
<TBODY>
<TR>
<TD colSpan=2 height=11><BR>&nbsp;&nbsp;&nbsp; 文/WATERSWEA<SPAN class=f14>　　一、认识Web.config文件<BR><BR>　　Web.config文件是一个XML文本文件，它用来储存 ASP.NET Web 应用程序的配置信息（如最常用的设置ASP.NET Web 应用程序的身份验证方式），它可以出现在应用程序的每一个目录中。当你通过VB.NET新建一个Web应用程序后，默认情况下会在根目录自动创建一个默认的<BR>Web.config文件，包括默认的配置设置，所有的子目录都继承它的配置设置。如果你想修改子目录的配置设置，你可以在该子目录下新建一个Web.config文件。它可以提供除从父目录继承的配置信息以外的配置信息，也可以重写或修改父目录中定义的设置。<BR><BR>　　在运行时对Web.config文件的修改不需要重启服务就可以生效（注：＜processModel＞ 节例外）。当然Web.config文件是可以扩展的。你可以自定义新配置参数并编写配置节处理程序以对它们进行处理。 <BR><BR>　　二、web.config配置文件（默认的配置设置）以下所有的代码都应该位于<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=1>
<TBODY>
<TR>
<TD>＜configuration＞<BR>＜system.web＞</TD></TR></TBODY></TABLE><BR>　　和<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=1>
<TBODY>
<TR>
<TD>＜/system.web＞<BR>＜/configuration＞</TD></TR></TBODY></TABLE><BR>　　之间，出于学习的目的下面的示例都省略了这段XML标记<BR><BR>　　1、＜authentication＞ 节<BR><BR>　　作用：配置 ASP.NET 身份验证支持（为Windows、Forms、PassPort、None四种）。该元素只能在计算机、站点或应用程序级别声明。＜authentication＞ 元素必需与＜authorization＞ 节配合使用。<BR><BR>　　示例：<BR><BR>　　以下示例为基于窗体（Forms）的身份验证配置站点，当没有登陆的用户访问需要身份验证的网页，网页自动跳转到登陆网页。<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=1>
<TBODY>
<TR>
<TD>＜authentication mode="Forms" ＞ <BR>＜forms loginUrl="logon.aspx" name=".FormsAuthCookie"/＞<BR><BR>＜/authentication＞</TD></TR></TBODY></TABLE><BR>　　其中元素loginUrl表示登陆网页的名称，name表示Cookie名称<BR><BR>　　2、＜authorization＞ 节<BR><BR>　　作用：控制对 URL 资源的客户端访问（如允许匿名用户访问）。此元素可以在任何级别（计算机、站点、应用程序、子目录或页）上声明。必需与＜authentication＞ 节配合使用。<BR><BR>　　示例：以下示例禁止匿名用户的访问<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=1>
<TBODY>
<TR>
<TD>＜authorization＞<BR>　＜deny users="?"/＞<BR>＜/authorization＞</TD></TR></TBODY></TABLE><BR>　　注：你可以使用user.identity.name来获取已经过验证的当前的用户名；可以使用<BR>web.Security.FormsAuthentication.RedirectFromLoginPage方法将已验证的用户重定向到用户刚才请求的页面.具体的实例请参考:<BR><BR>　　Forms验证 <A href="http://www.fanvb.net/websample/dataauth.aspx"><FONT color=#000000 size=2>http://www.fanvb.net/websample/dataauth.aspx</FONT></A><BR><BR>　　3、＜compilation＞节<BR><BR>　　作用：配置 ASP.NET 使用的所有编译设置。默认的debug属性为“True”.在程序编译完成交付使用之后应将其设为True（Web.config文件中有详细说明，此处省略示例）<BR><BR>　　4、＜customErrors＞ <BR><BR>　　作用：为 ASP.NET 应用程序提供有关自定义错误信息的信息。它不适用于 XML Web services 中发生的错误。<BR><BR>　　示例：当发生错误时，将网页跳转到自定义的错误页面。<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=1>
<TBODY>
<TR>
<TD>＜customErrors defaultRedirect="ErrorPage.aspx" mode="RemoteOnly"＞<BR>＜/customErrors＞</TD></TR></TBODY></TABLE><BR>　　其中元素defaultRedirect表示自定义的错误网页的名称。mode元素表示：对不在本地 Web 服务器上运行的用户显示自定义(友好的)信息。<BR><BR>　　5、＜httpRuntime＞节<BR><BR>　　作用：配置 ASP.NET HTTP 运行库设置。该节可以在计算机、站点、应用程序和子目录级别声明。<BR><BR>　　示例：控制用户上传文件最大为4M，最长时间为60秒，最多请求数为100<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=1>
<TBODY>
<TR>
<TD>＜httpRuntime maxRequestLength="4096" executionTimeout="60" appRequestQueueLimit="100"/＞</TD></TR></TBODY></TABLE><BR>　　6、 ＜pages＞<BR><BR>　　作用：标识特定于页的配置设置（如是否启用会话状态、视图状态，是否检测用户的输入等）。＜pages＞可以在计算机、站点、应用程序和子目录级别声明。<BR><BR>　　示例：不检测用户在浏览器输入的内容中是否存在潜在的危险数据（注：该项默认是检测，如果你使用了不检测，一要对用户的输入进行编码或验证)，在从客户端回发页时将检查加密的视图状态，以验证视图状态是否已在客户端被篡改。(注：该项默认是不验证）<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=1>
<TBODY>
<TR>
<TD>＜pages buffer="true" enableViewStateMac="true" validateRequest="false"/＞</TD></TR></TBODY></TABLE><BR>　　7、＜sessionState＞<BR><BR>　　作用：为当前应用程序配置会话状态设置（如设置是否启用会话状态，会话状态保存位置）。<BR><BR>　　示例：<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=1>
<TBODY>
<TR>
<TD>＜sessionState mode="InProc" cookieless="true" timeout="20"/＞<BR>＜/sessionState＞</TD></TR></TBODY></TABLE><BR>　　注：<BR><BR>　　mode="InProc"表示：在本地储存会话状态（你也可以选择储存在远程服务器或SAL服务器中或不启用会话状态）<BR><BR>　　cookieless="true"表示：如果用户浏览器不支持Cookie时启用会话状态(默认为False）<BR><BR>　　timeout="20"表示：会话可以处于空闲状态的分钟数<BR><BR>　　8、＜trace＞<BR><BR>　　作用：配置 ASP.NET 跟踪服务，主要用来程序测试判断哪里出错。<BR><BR>　　示例：以下为Web.config中的默认配置：<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=1>
<TBODY>
<TR>
<TD>＜trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" /＞</TD></TR></TBODY></TABLE><BR>　　注：<BR><BR>　　enabled="false"表示不启用跟踪；requestLimit="10"表示指定在服务器上存储的跟踪请求的数目 <BR><BR>　　pageOutput="false"表示只能通过跟踪实用工具访问跟踪输出；<BR><BR>　　traceMode="SortByTime"表示以处理跟踪的顺序来显示跟踪信息<BR><BR>　　localOnly="true" 表示跟踪查看器 (trace.axd) 只用于宿主 Web 服务器<BR><BR>　　三、自定义Web.config文件配置节<BR><BR>　　自定义Web.config文件配置节过程分为两步。<BR><BR>　　一是在在配置文件顶部 ＜configSections＞ 和 ＜/configSections＞标记之间声明配置节的名称和处理该节中配置数据的 .NET Framework 类的名称。<BR><BR>　　二是在 ＜configSections＞ 区域之后为声明的节做实际的配置设置。<BR><BR>　　示例：创建一个节存储数据库连接字符串<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=1>
<TBODY>
<TR>
<TD>＜configuration＞<BR>　＜configSections＞<BR>　＜section name="appSettings" type="System.Configuration.NameValueFileSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/＞<BR>＜/configSections＞<BR><BR>　＜appSettings＞<BR>　　＜add key="scon" value="server=a;database=northwind;uid=sa;pwd=123"/＞<BR>　＜/appSettings＞<BR><BR>　＜system.web＞<BR>　　......<BR>　＜/system.web＞<BR>＜/configuration＞ </TD></TR></TBODY></TABLE><BR>　　四、访问Web.config文件<BR><BR>　　你可以通过使用ConfigurationSettings.AppSettings 静态字符串集合来访问 Web.config 文件示例：获取上面例子中建立的连接字符串。<BR><BR>
<TABLE borderColor=#ffcc66 width="90%" align=center bgColor=#dadacf border=1>
<TBODY>
<TR>
<TD>Dim sconstr As String = ConfigurationSettings.AppSettings("SconStr")<BR>Dim scon = New SqlConnection(sconstr)</TD></TR></TBODY></TABLE></SPAN></TD></TR></TBODY></TABLE><img src ="http://www.blogjava.net/Microhelp/aggbug/17839.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-11-02 16:39 <a href="http://www.blogjava.net/Microhelp/articles/17839.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>水晶报表的使用（二）</title><link>http://www.blogjava.net/Microhelp/articles/14062.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Mon, 26 Sep 2005 01:50:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/14062.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/14062.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/14062.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/14062.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/14062.html</trackback:ping><description><![CDATA[<P><STRONG>导出：<BR></STRONG>//********************************************<BR>//<BR>//File Name:&nbsp;&nbsp;&nbsp;&nbsp; WebExportReport.sln<BR>//Created:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; May 17, 2002<BR>//Author ID:&nbsp;&nbsp;&nbsp;&nbsp; CHO<BR>//Purpose:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This sample application demonstrates how to export your report <BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to the following formats:<BR>//<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Rich Text Format (RTF)<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Microsoft Word Format (DOC)<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Portable Document Format (PDF)<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Microsoft Excel (XLS)<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - Crystal Report (RPT)<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - HTML 3.2 (HTML)<BR>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - HTML 4.0 (DHTML)&nbsp; <BR>//<BR>//********************************************</P>
<P>using System;<BR>using System.IO;<BR>using System.Collections;<BR>using System.ComponentModel;<BR>using System.Data;<BR>using System.Drawing;<BR>using System.Web;<BR>using System.Web.SessionState;<BR>using System.Web.UI;<BR>using System.Web.UI.WebControls;<BR>using System.Web.UI.HtmlControls;<BR>using CrystalDecisions.CrystalReports.Engine;<BR>using CrystalDecisions.Shared;<BR>using System.Data.OleDb;</P>
<P>namespace WebExportReport<BR>{<BR>&nbsp;/// &lt;summary&gt;<BR>&nbsp;/// Summary description for WebForm1.<BR>&nbsp;/// &lt;/summary&gt;<BR>&nbsp;public class WebForm1 : System.Web.UI.Page<BR>&nbsp;{<BR>&nbsp;&nbsp;protected System.Web.UI.WebControls.Button Button1;<BR>&nbsp;&nbsp;protected System.Web.UI.WebControls.DropDownList DropDownList1;<BR>&nbsp;&nbsp;&nbsp;&nbsp; protected DataSet dataSet = new DataSet(); <BR>&nbsp;&nbsp;// CR Variables<BR>&nbsp;&nbsp;ReportDocument crReportDocument;<BR>&nbsp;&nbsp;ExportOptions crExportOptions;<BR>&nbsp;&nbsp;protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer2;<BR>&nbsp;&nbsp;DiskFileDestinationOptions crDiskFileDestinationOptions;</P>
<P>&nbsp;&nbsp;private void Page_Load(object sender, System.EventArgs e)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;private void initDataSet()<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;string querySql ="select * from tblLotTrack where lot&lt; 535120 and stn &lt; 5000 ";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= c:\LTS2005.mdb");<BR>&nbsp;&nbsp;&nbsp;cn.Open();&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;OleDbDataAdapter adapter = new OleDbDataAdapter(querySql,cn);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;adapter.SelectCommand = new OleDbCommand(querySql, cn);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;adapter.Fill(dataSet);&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;#region Web Form Designer generated code<BR>&nbsp;&nbsp;override protected void OnInit(EventArgs e)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;//<BR>&nbsp;&nbsp;&nbsp;// CODEGEN: This call is required by the ASP.NET Web Form Designer.<BR>&nbsp;&nbsp;&nbsp;//<BR>&nbsp;&nbsp;&nbsp;InitializeComponent();<BR>&nbsp;&nbsp;&nbsp;base.OnInit(e);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; initDataSet();</P>
<P>&nbsp;&nbsp;&nbsp;//Create an instance of the strongly-typed report object<BR>&nbsp;&nbsp;&nbsp;crReportDocument = new CrystalReport1();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; crReportDocument.SetDataSource(dataSet);<BR>&nbsp;&nbsp;&nbsp;CrystalReportViewer2.ReportSource = crReportDocument;</P>
<P>&nbsp;&nbsp;&nbsp;// *******************************************<BR>&nbsp;&nbsp;&nbsp;// Initialize Dropdownlist for Format types<BR>&nbsp;&nbsp;&nbsp;// *******************************************<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DropDownList1.Items.Add("");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DropDownList1.Items.Add("Rich Text (RTF)");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DropDownList1.Items.Add("Portable Document (PDF)");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DropDownList1.Items.Add("MS Word (DOC)");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DropDownList1.Items.Add("MS Excel (XLS)");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DropDownList1.Items.Add("Crystal Report (RPT)");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DropDownList1.Items.Add("HTML 3.2 (HTML)");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DropDownList1.Items.Add("HTML 4.0 (HTML)");<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;/// &lt;summary&gt;<BR>&nbsp;&nbsp;/// Required method for Designer support - do not modify<BR>&nbsp;&nbsp;/// the contents of this method with the code editor.<BR>&nbsp;&nbsp;/// &lt;/summary&gt;<BR>&nbsp;&nbsp;private void InitializeComponent()<BR>&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;this.Button1.Click += new System.EventHandler(this.Button1_Click);<BR>&nbsp;&nbsp;&nbsp;this.Load += new System.EventHandler(this.Page_Load);</P>
<P>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;#endregion</P>
<P>&nbsp;&nbsp;private void ExportReport()<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;// This subroutine uses a case statement to determine the selected export format from the dropdownlist<BR>&nbsp;&nbsp;&nbsp;// menu and then sets the appropriate export options for the selected export format.&nbsp; The report is <BR>&nbsp;&nbsp;&nbsp;// exported to a subdirectory called "Exported".</P>
<P>&nbsp;&nbsp;&nbsp;// ********************************<BR>&nbsp;&nbsp;&nbsp;//Check to see if the application directory has a subdirectory called "Exported".<BR>&nbsp;&nbsp;&nbsp;//If not, create the directory since exported files will be placed here.<BR>&nbsp;&nbsp;&nbsp;//This uses the Directory class of the System.IO namespace.<BR>&nbsp;&nbsp;&nbsp;string ExportPath;<BR>&nbsp;&nbsp;&nbsp;ExportPath = Request.PhysicalApplicationPath + "Exported\\";<BR>&nbsp;&nbsp;&nbsp;if (Directory.Exists(ExportPath) == false) Directory.CreateDirectory(Request.PhysicalApplicationPath + "Exported\\");</P>
<P>&nbsp;&nbsp;&nbsp;// ********************************<BR>&nbsp;&nbsp;&nbsp;// First we must create a new instance of the diskfiledestinationoptions class and<BR>&nbsp;&nbsp;&nbsp;// set variable called crExportOptions to the exportoptions class of the reportdocument.<BR>&nbsp;&nbsp;&nbsp;crDiskFileDestinationOptions = new DiskFileDestinationOptions();<BR>&nbsp;&nbsp;&nbsp;crExportOptions = crReportDocument.ExportOptions;</P>
<P><BR>&nbsp;&nbsp;&nbsp;//Find the export type specified in the dropdownlist and export the report. The possible export format<BR>&nbsp;&nbsp;&nbsp;//types are Rich Text(RTF), Portable Document (PDF), MS Word (DOC), MS Excel (XLS), Crystal Report (RPT),<BR>&nbsp;&nbsp;&nbsp;//HTML 3.2 (HTML) and HTML 4.0 (HTML)<BR>&nbsp;&nbsp;&nbsp;//<BR>&nbsp;&nbsp;&nbsp;//Though not used in this sample application, there are options that can be specified for various format types.<BR>&nbsp;&nbsp;&nbsp;//When exporting to Rich Text, Word, or PDF, you can use the PdfRtfWordFormatOptions class to specify the<BR>&nbsp;&nbsp;&nbsp;//first page, last page or page range to be exported.<BR>&nbsp;&nbsp;&nbsp;//When exporting to Excel, you can use the ExcelFormatOptions class to specify export properties such as<BR>&nbsp;&nbsp;&nbsp;//the column width etc.</P>
<P>&nbsp;&nbsp;&nbsp;if (DropDownList1.SelectedItem.Text == "Rich Text (RTF)")<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;//Export to RTF. </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;//append a filename to the export path and set this file as the filename property for<BR>&nbsp;&nbsp;&nbsp;&nbsp;//the DestinationOptions class<BR>&nbsp;&nbsp;&nbsp;&nbsp;crDiskFileDestinationOptions.DiskFileName = ExportPath + "RichTextFormat.rtf";</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;//set the required report ExportOptions properties<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportFormatType = ExportFormatType.RichText;<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.DestinationOptions = crDiskFileDestinationOptions;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else if (DropDownList1.SelectedItem.Text == "Portable Document (PDF)")<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;//Export to PDF</P>
<P><BR>&nbsp;&nbsp;&nbsp;&nbsp;//append a filename to the export path and set this file as the filename property for<BR>&nbsp;&nbsp;&nbsp;&nbsp;//the DestinationOptions class<BR>&nbsp;&nbsp;&nbsp;&nbsp;crDiskFileDestinationOptions.DiskFileName = ExportPath + "PortableDoc.pdf";</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;//set the required report ExportOptions properties<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.DestinationOptions = crDiskFileDestinationOptions;<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else if (DropDownList1.SelectedItem.Text == "MS Word (DOC)")<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;//Export to Word</P>
<P><BR>&nbsp;&nbsp;&nbsp;&nbsp;//append a filename to the export path and set this file as the filename property for<BR>&nbsp;&nbsp;&nbsp;&nbsp;//the DestinationOptions class<BR>&nbsp;&nbsp;&nbsp;&nbsp;crDiskFileDestinationOptions.DiskFileName = ExportPath + "Word.doc";</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;//set the required report ExportOptions properties<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportFormatType = ExportFormatType.WordForWindows;<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.DestinationOptions = crDiskFileDestinationOptions;<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;<BR>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else if (DropDownList1.SelectedItem.Text == "MS Excel (XLS)")<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;//Export to Excel</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;//append a filename to the export path and set this file as the filename property for<BR>&nbsp;&nbsp;&nbsp;&nbsp;//the DestinationOptions class<BR>&nbsp;&nbsp;&nbsp;&nbsp;crDiskFileDestinationOptions.DiskFileName = ExportPath + "Excel.xls";</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;//set the required report ExportOptions properties<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportFormatType = ExportFormatType.Excel;<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.DestinationOptions = crDiskFileDestinationOptions;<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;<BR>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else if (DropDownList1.SelectedItem.Text == "Crystal Report (RPT)")<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;//Export to Crystal reports:</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;//append a filename to the export path and set this file as the filename property for<BR>&nbsp;&nbsp;&nbsp;&nbsp;//the DestinationOptions class<BR>&nbsp;&nbsp;&nbsp;&nbsp;crDiskFileDestinationOptions.DiskFileName = ExportPath + "Report.rpt";</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;//set the required report ExportOptions properties<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportFormatType = ExportFormatType.CrystalReport;<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.DestinationOptions = crDiskFileDestinationOptions;<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;<BR>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else if (DropDownList1.SelectedItem.Text == "HTML 3.2 (HTML)")<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;//Export to HTML32:</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;HTMLFormatOptions HTML32Formatopts = new HTMLFormatOptions();</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportFormatType = ExportFormatType.HTML32;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;HTML32Formatopts.HTMLBaseFolderName = ExportPath + "Html32Folder"; //Foldername to place HTML files<BR>&nbsp;&nbsp;&nbsp;&nbsp;HTML32Formatopts.HTMLFileName = "HTML32.html";<BR>&nbsp;&nbsp;&nbsp;&nbsp;HTML32Formatopts.HTMLEnableSeparatedPages = false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;HTML32Formatopts.HTMLHasPageNavigator = false;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.FormatOptions = HTML32Formatopts;<BR>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;else if (DropDownList1.SelectedItem.Text == "HTML 4.0 (HTML)")<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;//--------------------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;//Export to Html 4.0:</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;HTMLFormatOptions HTML40Formatopts = new HTMLFormatOptions();</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;<BR>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.ExportFormatType = ExportFormatType.HTML40;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;HTML40Formatopts.HTMLBaseFolderName = ExportPath + "Html40Folder"; // Foldername to place HTML files<BR>&nbsp;&nbsp;&nbsp;&nbsp;HTML40Formatopts.HTMLFileName = "HTML40.html";<BR>&nbsp;&nbsp;&nbsp;&nbsp;HTML40Formatopts.HTMLEnableSeparatedPages = true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;HTML40Formatopts.HTMLHasPageNavigator = true;<BR>&nbsp;&nbsp;&nbsp;&nbsp;HTML40Formatopts.FirstPageNumber = 1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;HTML40Formatopts.LastPageNumber = 3;</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;crExportOptions.FormatOptions = HTML40Formatopts;<BR>&nbsp;&nbsp;&nbsp;} //export format</P>
<P>&nbsp;&nbsp;&nbsp;//Once the export options have been set for the report, the report can be exported. The Export command<BR>&nbsp;&nbsp;&nbsp;//does not take any arguments<BR>&nbsp;&nbsp;&nbsp;try<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Export the report<BR>&nbsp;&nbsp;&nbsp;&nbsp;crReportDocument.Export();<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;catch (Exception err)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;Response.Write("&lt;BR&gt;");<BR>&nbsp;&nbsp;&nbsp;&nbsp;Response.Write(err.Message.ToString());<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;private void Button1_Click(object sender, System.EventArgs e)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;//Clicking on the "Export Report" button will run the ExportReport subroutine and export the report based on the<BR>&nbsp;&nbsp;&nbsp;//selected format from the dropdownlist.<BR>&nbsp;&nbsp;&nbsp;ExportReport();<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}<BR></P><img src ="http://www.blogjava.net/Microhelp/aggbug/14062.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-09-26 09:50 <a href="http://www.blogjava.net/Microhelp/articles/14062.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>水晶报表的使用（一）</title><link>http://www.blogjava.net/Microhelp/articles/14061.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Mon, 26 Sep 2005 01:49:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/14061.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/14061.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/14061.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/14061.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/14061.html</trackback:ping><description><![CDATA[<DIV class=topic align=left>官方水晶报表.NET 应用程序实例下载(C#、Visual C++.NET)</DIV>
<P><A href="http://www.weste.net/html/200408/20040825QBI101746.html">http://www.weste.net/html/200408/20040825QBI101746.html</A><BR><BR>1、<STRONG>升级</STRONG><BR>下载水晶报表10。安装时选择.NET组件。如果VS2003已经安装好会自动将其内置水晶报表升级为10<BR>&nbsp;License : AV860-01CS00G-U7000NC SN : 1231467890<BR>2、使用<BR>拖一个CrystalReportViewer到Form上<BR>添加新项目，选择水晶报表。安装向导连接数据库选择表即可建成rpt文件。<BR>添加如下代码：<BR>&nbsp;&nbsp;private void Page_Load(object sender, System.EventArgs e)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; initDataSet();</P>
<P>&nbsp;&nbsp;&nbsp;//Create an instance of the strongly-typed report object<BR>&nbsp;&nbsp;&nbsp;LotTrackCross crReportDocument = new LotTrackCross();</P>
<P>&nbsp;&nbsp;&nbsp;//Pass the populated dataset to the report<BR>&nbsp;&nbsp;&nbsp;crReportDocument.SetDataSource(dataSet);</P>
<P>&nbsp;&nbsp;&nbsp;//Set the viewer to the report object to be previewed.<BR>&nbsp;&nbsp;&nbsp;CrystalReportViewer1.ReportSource = crReportDocument;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;private void initDataSet()<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;string querySql ="select * from tblLotTrack where lot&lt; 535120 and stn &lt; 5000 ";&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= c:\LTS2005.mdb");<BR>&nbsp;&nbsp;&nbsp;cn.Open();&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;OleDbDataAdapter adapter = new OleDbDataAdapter(querySql,cn);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;adapter.SelectCommand = new OleDbCommand(querySql, cn);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;adapter.Fill(dataSet);&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;}<BR>注意：填充使用的DataSet要和建立rpt文件的表名、列名对应</P><img src ="http://www.blogjava.net/Microhelp/aggbug/14061.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-09-26 09:49 <a href="http://www.blogjava.net/Microhelp/articles/14061.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET常见错误及解决方案</title><link>http://www.blogjava.net/Microhelp/articles/13904.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Sat, 24 Sep 2005 01:48:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/13904.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/13904.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/13904.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/13904.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/13904.html</trackback:ping><description><![CDATA[
		<ul>
				<li>
						<font size="4">
								<strong>Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged</strong>
						</font>.<br />当IIS服务器的虚拟目录不是应用程序的时候会出现这种错误。当启动页面的目录层大于一层时,例如:<br /><a href="http://localhost/CRNETSamples/cr10_csharp_web_ClientPrinting/WebForm1.aspx">http://localhost/CRNETSamples/cr10_csharp_web_ClientPrinting/WebForm1.aspx</a><br />需要在IIS为第二层目录创建应用程序。否则会出现上诉错误信息。
</li>
				<li>
						<font size="4">
								<strong>sqlserver数据库登陆失败：<em>用户 'CLEVER06\ASPNET' 登录失败</em></strong>
						</font>
				</li>
		</ul>
		<p>
				<em>         </em>我用建立sqlDataAdaper的方法获得连接字符串，第一次选择连接的时候选择信任连接<br />         得到字符串如下。出现如上错误<br />         workstation id=CLEVER06;packet size=4096;user id=sa;password=sa;integrated security=SSPI;<br />         data  source=Clever06;persist security info=False;initial catalog=IPDataBase<br />         第二次不使用信任连接<br />          workstation id=CLEVER06;packet size=4096;user id=sa;password=sa;data source=clever06;persist security <br />          info=False;initial catalog=IPDataBase<br />         错误消失<br /><a name="vberrvisualstudionetcannotcreateapplicationlikeliestproblemisthatrequiredcomponentsarenotinstalledonlocalwebserver"></a><font size="4">       Visual Studio .NET cannot create the application &lt;application&gt;. The likeliest problem is <br />       that  required components are not installed on the local Web server<br />       <font size="3">原因一，asp.net framework没有被注册，使用aspnet_regiis /i 注册即可。<br />         原因二，没有为应用程序建立虚拟目录。</font><br /><strong>       文件夹属性没有安全设置选项<br /></strong>       <font size="3">公司有域环境，电脑没有加入域，加入后即可</font></font></p>
		<!--NONSCROLLING BANNER END-->
<img src ="http://www.blogjava.net/Microhelp/aggbug/13904.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-09-24 09:48 <a href="http://www.blogjava.net/Microhelp/articles/13904.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Visual C# 打造 “浏览器”</title><link>http://www.blogjava.net/Microhelp/articles/13634.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Wed, 21 Sep 2005 06:26:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/13634.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/13634.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/13634.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/13634.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/13634.html</trackback:ping><description><![CDATA[<P class=fontsize10 style="FONT-SIZE: 10.5pt">Visual C＃是微软推出的新一代程序开发语言，Visual C＃实现许多功能是通过调用.Net框架为其中所有.Net程序开发语言提供的一个公用的软件包——.Net FrameWork SDK。在这个软件包中提供了大量并且十分丰富的类库，可以说，没有这个软件开发包，Visual C＃就寸步难行，无法编写哪怕一个功能十分的程序。但这样也会出现一个问题，如果在.Net FrameWork SDK软件包中没有涉及到的功能，而在其他的第三方的COM组件中却提供了，那么这些组件是否可以被Visual C＃使用。答案是：直接使用是不可以的，但这些COM组件经过一定转换后就可以。这种转换就是非受管代码（Unmanaged Code）到受管代码（Managed Code）的转换。因为这些COM组件一般都是非受管代码（Unmanaged Code），而编译Visual C＃文件时候要使用的类库却只能为受管代码（Managed Code），这就是说要在Visual C＃中使用那些非受管代码组件，就必须把这些非受管代码组件转换成受管代码组件。在.Net框架中专门提供了一个程序“Aximp.exe”来实现由COM组件到WinForm组件的转换。那么这个文件在哪里？假设你安装.Net FrameWork SDK在“C”盘，那么在“C:\Program Files\Microsoft.NET\FrameworkSDK\Bin”目录中就可以找到这个文件。如果你安装.Net FrameWork SDK在其他目录或者磁盘，依照上述的目录顺序就可以找到这个文件了。 <BR>下面用Visual C＃来做一个“浏览器”，看看在Visual C＃是如何使用COM组件的。 <BR><STRONG><FONT color=#000080>一．本文程序设计和运行的软件环境</FONT> <BR></STRONG>（1）.微软公司视窗2000服务器版 <BR>（2）..Net FrameWork SDK Beta 2 <BR><STRONG><FONT color=#000080>二．程序设计的思路以及关键步骤的解决方法</FONT></STRONG> <BR>（1）.把转换COM组件为WinForm组件： <BR>其实实现这种转换十分的简单，我们知道微软Web浏览器COM组件名称为“shdocvw.dll”，由于我们使用的是视窗2000，所以这个文件是存放在“c:\winnt\system32”目录中，如果你使用的是视窗98或者是视窗Me，那么此组件存放的位置是“c:\windows\system”。“Aximp.exe”文件后面有许多的参数，你可以通过“Aximp /?”来了解，在本文中只使用下列简单的命令就可成功转换： <BR>Aximp c:\winnt\system32\shdocvw.dll <BR>运行上述命令后就可以实现转换，并在当前目录中产生“SHDocVw.dll”和“AxSHDocVw.dll”二个文件。具体如下图： <BR><BR>图01：转换COM组件为WinForm组件 <BR>（2）.在程序中使用转换后组件： <BR>在“AxSHDocVw.dll”中定义了命名空间“AxSHDocVw”，在此命名空间中定义了一个“AxWebBrowser”组件，这个组件中有若干个方法和属性，Visual C＃就是通过这些方法和属性来实现浏览器的一些基本功能的。使用此浏览器组件和使用其他的WinForm组件的过程是一样的，首先要导入命名空间，然后在程序中继承此命名空间中定义的浏览器组件，最后设定这个继承后的组件的属性和方法。具体如下： <BR>&lt; I &gt; .导入命名空间，具体代码如下： <BR>using AxSHDocVw ; <BR>&lt; II&gt; . 继承此命名空间中定义的浏览器组件，具体代码如下： <BR>private AxWebBrowser axWebBrowser1 ; <BR>（3）.通过转换后组件来实现浏览器的一些基本功能： <BR>浏览器的主要功能就是能够到指定的地址浏览信息，当然在具体的浏览中还有一些基本的功能，譬如：“前进”、“后退”、“停止”、“刷新”、“主页”等，这些功能都可以通过“AxWebBrowser”组件来实现。下面就来具体介绍： <BR>&lt; I &gt; .浏览指定的地址： <BR>在程序中，网址是填写在组件“textbox1”中的，“浏览指定地址”功能是通过程序的按钮“转到”来实现的。下面是按钮“转到”按动后的程序代码： <BR>private void button1_Click ( object sender , System.EventArgs e ) <BR>{ <BR>System.Object nullObject = 0 ; <BR>string str = "" ; <BR>System.Object nullObjStr = str ; <BR>Cursor.Current = Cursors.WaitCursor ; <BR>axWebBrowser1.Navigate ( textBox1.Text , ref nullObject , ref nullObjStr , ref nullObjStr , ref nullObjStr ) ; <BR>Cursor.Current = Cursors.Default ; <BR>} <BR>&lt; II &gt; .浏览器的“前进”、“后退”、“停止”、“刷新”、“主页”功能： <BR>在“AxWebBrowser”组件中对这些功能都有一个具体的方法来与之对应，具体如下面代码： <BR>private void toolBar1_ButtonClick ( object sender , ToolBarButtonClickEventArgs e ) <BR>{ <BR>//浏览器中的“后退” <BR>if ( e.Button == tb1 ) <BR>{ <BR>axWebBrowser1.GoBack ( ) ; <BR>} <BR>//浏览器中的“前进” <BR>if ( e.Button == tb2 ) <BR>{ <BR>axWebBrowser1.GoForward ( ) ; <BR>} <BR>//浏览器中的“停止” <BR>if ( e.Button == tb3 ) <BR>{ <BR>axWebBrowser1.Stop ( ) ; <BR>} <BR>//浏览器中的“刷新” <BR>if ( e.Button == tb4 ) <BR>{ <BR>axWebBrowser1.Refresh ( ) ; <BR>} <BR>//浏览器中的“主页” <BR>if ( e.Button == tb5 ) <BR>{ <BR>axWebBrowser1.GoHome ( ) ; <BR>} <BR><BR>} <BR>&lt; III &gt; .当然掌握了上面的知识，你就可以用Visual C＃做出一个基本的浏览器了，但下面这些也是不可缺少的，因为下面这些代码将使得你做的浏览器更专业。下面代码的作用是使得浏览界面随着窗体的变化而变化，按钮和文本框也要随着窗体的变化而变化。 <BR>button1.Anchor = ( AnchorStyles.Top | AnchorStyles.Right ) ; <BR>//定位“转到”按钮组件与窗体的上、右边框保持一致 <BR>textBox1.Anchor = ( ( AnchorStyles.Top | AnchorStyles.Left ) <BR>| AnchorStyles.Right ) ; <BR>//定位地址文本框组件与窗体的上、左、右边框保持一致 <BR>axWebBrowser1.Anchor = ( ( ( AnchorStyles.Top | AnchorStyles.Bottom ) <BR>| AnchorStyles.Left ) <BR>| AnchorStyles.Right ) ; <BR>//定位浏览器组件与窗体的上、下、左、右边框保持一致 <BR><STRONG><FONT color=#000080>三．源程序代码（brower.cs）</FONT></STRONG> <BR>了解有了上面的这些，就可以比较容易编写一个属于自己的浏览器了，下面是用Visual C＃做的浏览器源程序代码，他具备了IE浏览器的一些常用的功能。 <BR>using System ; <BR>using System.Drawing ; <BR>using System.Collections ; <BR>using System.ComponentModel ; <BR>using System.Windows.Forms ; <BR>using System.Data ; <BR>using AxSHDocVw ; <BR>public class Form1 : Form <BR>{ <BR>private ToolBar toolBar1 ; <BR>private ToolBarButton tb1 ; <BR>private ToolBarButton tb2 ; <BR>private ToolBarButton tb3 ; <BR>private ToolBarButton tb4 ; <BR>private ToolBarButton tb5 ; <BR>private Label label1 ; <BR>private TextBox textBox1 ; <BR>private Button button1 ; <BR>private AxWebBrowser axWebBrowser1 ; <BR>private System.ComponentModel.Container components = null ; <BR>public Form1 ( ) <BR>{ <BR>InitializeComponent ( ) ; <BR>} <BR>//清除程序中使用过的资源 <BR>protected override void Dispose ( bool disposing ) <BR>{ <BR>if ( disposing ) <BR>{ <BR>if ( components != null ) <BR>{ <BR>components.Dispose ( ) ; <BR>} <BR>} <BR>base.Dispose ( disposing ) ; <BR>} <BR>//初始化窗体中的各个组件 <BR>private void InitializeComponent ( ) <BR>{ <BR>tb1 = new ToolBarButton ( ) ; <BR>tb2 = new ToolBarButton ( ) ; <BR>tb3 = new ToolBarButton ( ) ; <BR>toolBar1 = new ToolBar ( ) ; <BR>tb4 = new ToolBarButton ( ) ; <BR>tb5 = new ToolBarButton ( ) ; <BR>button1 = new Button ( ) ; <BR>textBox1 = new TextBox ( ) ; <BR>axWebBrowser1 = new AxWebBrowser ( ) ; <BR>label1 = new Label ( ) ; <BR>( ( System.ComponentModel.ISupportInitialize ) ( this.axWebBrowser1 ) ).BeginInit ( ) ; <BR>this.SuspendLayout ( ) ; <BR><BR>tb1.Text = "后退" ; <BR>tb2.Text = "前进" ; <BR>tb3.Text = "停止" ; <BR>tb4.Text = "刷新" ; <BR>tb5.Text = "主页" ; <BR><BR>toolBar1.Appearance = ToolBarAppearance.Flat ; <BR>toolBar1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle ; <BR>//在工具栏中加入按钮 <BR>toolBar1.Buttons.Add ( tb1 ) ; <BR>toolBar1.Buttons.Add ( tb2 ) ; <BR>toolBar1.Buttons.Add ( tb3 ) ; <BR>toolBar1.Buttons.Add ( tb4 ) ; <BR>toolBar1.Buttons.Add ( tb5 ) ; <BR>toolBar1.DropDownArrows = true ; <BR>toolBar1.Name = "toolBar1" ; <BR>toolBar1.ShowToolTips = true ; <BR>toolBar1.Size = new System.Drawing.Size ( 612 , 39 ) ; <BR>toolBar1.TabIndex = 0 ; <BR>toolBar1.ButtonClick += new ToolBarButtonClickEventHandler ( toolBar1_ButtonClick ) ; <BR>//定位“转到”按钮组件与窗体的上、右边框保持一致 <BR>button1.Anchor = ( AnchorStyles.Top | AnchorStyles.Right ) ; <BR>button1.DialogResult = DialogResult.OK ; <BR>button1.Location = new System.Drawing.Point ( 544 , 45 ) ; <BR>button1.Name = "button1" ; <BR>button1.Size = new System.Drawing.Size ( 40 , 23 ) ; <BR>button1.TabIndex = 3 ; <BR>button1.Text = "转到" ; <BR>button1.Click += new System.EventHandler ( button1_Click ) ; <BR>//定位地址文本框组件与窗体的上、左、右边框保持一致 <BR>textBox1.Anchor = ( ( AnchorStyles.Top | AnchorStyles.Left ) <BR>| AnchorStyles.Right ) ; <BR>textBox1.Location = new System.Drawing.Point ( 64 , 47 ) ; <BR>textBox1.Name = "textBox1" ; <BR>textBox1.Size = new System.Drawing.Size ( 464 , 21 ) ; <BR>textBox1.TabIndex = 2 ; <BR>textBox1.Text = "" ; <BR>//定位浏览器组件与窗体的上、下、左、右边框保持一致 <BR>axWebBrowser1.Anchor = ( ( ( AnchorStyles.Top | AnchorStyles.Bottom ) <BR>| AnchorStyles.Left ) <BR>| AnchorStyles.Right ) ; <BR>axWebBrowser1.Enabled = true ; <BR>axWebBrowser1.Location = new System.Drawing.Point ( 0 , 72 ) ; <BR>axWebBrowser1.Size = new System.Drawing.Size ( 608 , 358 ) ; <BR>axWebBrowser1.TabIndex = 4 ; <BR><BR>label1.Location = new System.Drawing.Point ( 16 , 48 ) ; <BR>label1.Name = "label1" ; <BR>label1.Size = new System.Drawing.Size ( 48 , 16 ) ; <BR>label1.TabIndex = 1 ; <BR>label1.Text = "地址：" ; <BR><BR>this.AutoScaleBaseSize = new System.Drawing.Size ( 6 , 14 ) ; <BR>this.ClientSize = new System.Drawing.Size ( 612 , 433 ) ; <BR><BR>this.Controls.Add ( axWebBrowser1 ) ; <BR>this.Controls.Add ( button1 ) ; <BR>this.Controls.Add ( textBox1 ) ; <BR>this.Controls.Add ( label1 ) ; <BR>this.Controls.Add ( toolBar1 ) ; <BR>this.FormBorderStyle = FormBorderStyle.FixedSingle ; <BR>this.Name = "Form1" ; <BR>this.Text = "visual C＃做浏览器" ; <BR>( ( System.ComponentModel.ISupportInitialize ) ( this.axWebBrowser1 ) ).EndInit ( ) ; <BR>this.ResumeLayout ( false ) ; <BR><BR>} <BR>static void Main ( ) <BR>{ <BR>Application.Run ( new Form1 ( ) ) ; <BR>} <BR>//实现浏览器主要功能 <BR>private void toolBar1_ButtonClick ( object sender , ToolBarButtonClickEventArgs e ) <BR>{ <BR>//浏览器中的“后退” <BR>if ( e.Button == tb1 ) <BR>{ <BR>axWebBrowser1.GoBack ( ) ; <BR>} <BR>//浏览器中的“前进” <BR>if ( e.Button == tb2 ) <BR>{ <BR>axWebBrowser1.GoForward ( ) ; <BR>} <BR>//浏览器中的“停止” <BR>if ( e.Button == tb3 ) <BR>{ <BR>axWebBrowser1.Stop ( ) ; <BR>} <BR>//浏览器中的“刷新” <BR>if ( e.Button == tb4 ) <BR>{ <BR>axWebBrowser1.Refresh ( ) ; <BR>} <BR>//浏览器中的“主页” <BR>if ( e.Button == tb5 ) <BR>{ <BR>axWebBrowser1.GoHome ( ) ; <BR>} <BR><BR>} <BR>//浏览指定的Web地址 <BR>private void button1_Click ( object sender , System.EventArgs e ) <BR>{ <BR>System.Object nullObject = 0 ; <BR>string str = "" ; <BR>System.Object nullObjStr = str ; <BR>Cursor.Current = Cursors.WaitCursor ; <BR>axWebBrowser1.Navigate ( textBox1.Text , ref nullObject , ref nullObjStr , ref nullObjStr , ref nullObjStr ) ; <BR>Cursor.Current = Cursors.Default ; <BR>} <BR>} <BR><STRONG><FONT color=#000080>四．编译源程序和编译后的执行程序的运行界面</FONT></STRONG> <BR>在经过如下命令编译后，就可以得到可以自己的浏览器了 <BR>csc /t:winexe /r:AxSHDocVw.dll /r:SHDocVw.dll /r:system.dll <BR>/r:system.windows.forms.dll /r:system.drawing.dll brower.cs <BR>图02：用Visual C＃做的“浏览器”的运行界面 <BR><STRONG><FONT color=#000080>五．总结</FONT></STRONG> <BR>至此一个功能相对完备的“浏览器”就算完成了，其实用Visual C＃做“浏览器”的过程，也就是Visual C＃中使用COM组件的过程。掌握了COM组件在Visual C＃使用方法，就可以利用Visual C＃编写出功能更强大，适应性更强的软件来，但编写的过程又十分的简单。</P><img src ="http://www.blogjava.net/Microhelp/aggbug/13634.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-09-21 14:26 <a href="http://www.blogjava.net/Microhelp/articles/13634.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Web service 的一个简单示例</title><link>http://www.blogjava.net/Microhelp/articles/13495.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Tue, 20 Sep 2005 02:08:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/13495.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/13495.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/13495.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/13495.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/13495.html</trackback:ping><description><![CDATA[<P>从表面上看，Web service 就是一个应用程序，它向外界暴露出一个能够通过Web进行调用的API。这就是说，你能够用编程的方法通过Web来调用这个应用程序。</P>
<P>Web Service是一种具有下列功能的软件组件： <BR>● 可以通过SOAP 接口(Simple Object Access Protocol简单对象访问协议) 接口来进行访问 。 <BR>● 它是使用WSDL(Web Service Description Language，Web Service描述语言 ) 文档形式描述的接口。</P>
<P><STRONG>一、建立一个WebService</STRONG></P>
<P>打开.NET。新建工程。选择ASP.NET WEBSERVICE。确定。可以看到Service1.asmx.cs文件中有一个被注释掉的HelloWorld() example。</P>
<P>去掉注释。即可得到一个WebService的HelloWorld方法。</P>
<P>如果你愿意还可以添加别的方法。</P>
<P>运行即可看到你的可供调用的WebService方法的列表。</P>
<P><STRONG>二、调用WebService</STRONG></P>
<P>新建一个Windows Application。</P>
<P>在.NET中的调用相对简单。微软已经做好了中间的代理类，只有我们稍微做一下配置即可。</P>
<P>在SolutionExplor中右击Reference。添加WebReference。在URL栏中填入刚才WebService运行的地址。例如：<A href="http://localhost/WebService1/Service1.asmx">http://localhost/WebService1/Service1.asmx</A>。点击Go，即可看到你的WebService方法列表。点击添加引用。</P>
<P>在Form上添加一个按钮和一个文本框。在按钮的点击事件添加如下代码：</P>
<CENTER>
<TABLE borderColor=#000000 width=200 bgColor=#ccffff border=1>
<TBODY>
<TR>
<TD>
<P align=left>WindowsApplication1.WebReference.Service1 test = new WindowsApplication1.WebReference.Service1();</P>
<P>this.textBox1.Text = test.HelloWorld();</P></TD></TR></TBODY></TABLE></CENTER>
<P>在运行后点击按钮，可以看到文本框中的文本变成了Hello World。WebService调用成功。<BR><STRONG><FONT color=#ff0000>注</FONT></STRONG>：<BR>在调用WebService时出现如下错误System.Net.WebException: The request failed with HTTP status 401:&nbsp;<BR>Access Denied。在网上搜索一下发现出现这种错误的很多。原因不详。但是基本是权限问题造成的。<BR>我做了如下尝试<BR>●文件夹权限改成EveryOne都可以访问。<BR>●添加引用的时候把localhost改成127.0.0.1。<BR>●把ASPNET用户添加到管理员组。<BR>但是都没有奏效。然后我重新安装了IIS。发现可以了。仍然不知道是什么原因造成的。暂做记录。以备后查。<BR></P><img src ="http://www.blogjava.net/Microhelp/aggbug/13495.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-09-20 10:08 <a href="http://www.blogjava.net/Microhelp/articles/13495.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>C#的事件处理</title><link>http://www.blogjava.net/Microhelp/articles/13151.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Fri, 16 Sep 2005 05:54:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/13151.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/13151.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/13151.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/13151.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/13151.html</trackback:ping><description><![CDATA[<SPAN lang=EN-US style="FONT-SIZE: 12pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="COLOR: blue; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><FONT color=#800080>事件的参数<SPAN lang=EN-US><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></SPAN></B></P></SPAN>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="COLOR: blue; FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><FONT color=#000000>private</FONT></SPAN><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><FONT color=#000000> </FONT><SPAN style="COLOR: blue"><FONT color=#000000>void</FONT></SPAN> Button3_Click(object <B style="mso-bidi-font-weight: normal">sender</B>, System.EventArgs <B style="mso-bidi-font-weight: normal">e</B>)<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">一般来说，事件的相应方法会有两个参数，<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">参数：<B style="mso-bidi-font-weight: normal"><SPAN lang=EN-US>object</SPAN></B><SPAN lang=EN-US> <B style="mso-bidi-font-weight: normal">sender</B><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">其中一个代表引发事件的对象即<SPAN lang=EN-US>sender</SPAN>。由于引发事件的对象是不可知的，因此我们把其声明为<SPAN lang=EN-US>object</SPAN>类型。所有对象都适用。<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 21pt; TEXT-INDENT: 21pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">Button s = (Button)sender;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt"><SPAN style="mso-tab-count: 2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: blue"><FONT color=#000000>string</FONT></SPAN> a = s.Text;<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">参数：<B><SPAN lang=EN-US>EventArgs<o:p></o:p></SPAN></B></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">第二个参数代表引发事件的具体信息。</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">下面是<SPAN lang=EN-US>MSDN</SPAN>对这个类的描述</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">This class contains no event data; it is used by events that do not pass state information to an event handler when an event is raised. If the event handler requires state information, the application must derive a class from this class to hold the data<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-font-kerning: 0pt">各种事件中的类型可能不同。但是都是从</SPAN><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">EventArgs</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold">继承而来。例如<B><SPAN lang=EN-US><o:p></o:p></SPAN></B></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">DataGridItemEventArgs<o:p></o:p></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">The <A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclassitemcreatedtopic.htm"><SPAN style="COLOR: windowtext; TEXT-DECORATION: none; text-underline: none">ItemCreated</SPAN></A> event is raised when an item in the <A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclasstopic.htm"><SPAN style="COLOR: windowtext; TEXT-DECORATION: none; text-underline: none">DataGrid</SPAN></A> control is created.<o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">The <A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwebuiwebcontrolsdatagridclassitemdataboundtopic.htm"><SPAN style="COLOR: windowtext; TEXT-DECORATION: none; text-underline: none">ItemDataBound</SPAN></A> event is raised when an item in the DataGrid control is data bound to a source.<BR><BR><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt"><FONT color=#800080>事件的定义<SPAN lang=EN-US><o:p></o:p></SPAN></FONT></SPAN></B></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-bidi-font-size: 10.5pt">如何定义事件：<SPAN lang=EN-US><o:p></o:p></SPAN></SPAN></P><PRE><SPAN lang=EN-US><FONT face=宋体>[<I><SPAN style="mso-field-code: ' HYPERLINK '''"><SPAN class=MsoHyperlink><U><FONT color=#0000ff>attributes</FONT></U></SPAN></SPAN></I>] [<I><SPAN style="mso-field-code: ' HYPERLINK '''"><SPAN class=MsoHyperlink><U><FONT color=#0000ff>modifiers</FONT></U></SPAN></SPAN></I>] <B>event</B> <I><SPAN style="mso-field-code: ' HYPERLINK '''"><SPAN class=MsoHyperlink><U><FONT color=#0000ff>type</FONT></U></SPAN></SPAN></I> <I><SPAN style="mso-field-code: ' HYPERLINK '''"><SPAN class=MsoHyperlink><U><FONT color=#0000ff>declarator</FONT></U></SPAN></SPAN></I><B>;<o:p></o:p></B></FONT></SPAN></PRE>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><I><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">type</SPAN></I><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"> <o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-ALIGN: left; mso-pagination: widow-orphan" align=left><SPAN lang=EN-US style="mso-font-kerning: 0pt">The <A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/csref/html/vcrefthedelegatetype.htm">delegate</A> to which you want to associate this event. </SPAN><SPAN lang=EN-US style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"><o:p></o:p></SPAN></P><PRE><B><FONT face=宋体>例如：<SPAN lang=EN-US>public event MyDelegate MyEvent;<o:p></o:p></SPAN></FONT></B></PRE></SPAN><img src ="http://www.blogjava.net/Microhelp/aggbug/13151.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-09-16 13:54 <a href="http://www.blogjava.net/Microhelp/articles/13151.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于委托的精彩解说(转)</title><link>http://www.blogjava.net/Microhelp/articles/13062.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Thu, 15 Sep 2005 04:33:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/13062.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/13062.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/13062.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/13062.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/13062.html</trackback:ping><description><![CDATA[<P>来自：<A href="http://www.aspxboy.com/Files/71/67/281.Aspx">http://www.aspxboy.com/Files/71/67/281.Aspx</A><BR>有许多人问的，.Net中的委托以及事件处理。我拿简单的例子说明一下，是现实中的例子：<BR><BR>比如说一个公司（场景），你是老板，手下有两个员工，小张和小王。<BR>你命令小王，如果小张玩游戏，则小王扣去小张500元钱。<BR><BR>这就是现实中的委托。<BR><BR>实际上，在写程序中，程序员就是老板，小张和小王就是两个对象。小张玩游戏是一个方法，小张还有一个游戏事件，他玩游戏激发这个事件。而小王就是事件处理对象，他负责把小张的钱扣除500。<BR><BR>所以，委托有如下几个要素：<BR>1 激发事件的对象--就是小张<BR>2 处理对象事件的对象--就是小王<BR>3 定义委托，就是你让小王监视小张。<BR><BR>如果这三个要素都满足的话，则你就写出了一个完整事件的处理。<BR><BR>下面有个例子：在vs.net2003 C#控制台应用程序编辑运行成功：<BR>using System;</P>
<P>namespace CSharpConsole<BR>{<BR>&nbsp;public class 场景<BR>&nbsp;{<BR>&nbsp;&nbsp;[STAThread]<BR>&nbsp;&nbsp;public static void Main(string[] args)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine("场景开始了....");<BR>&nbsp;&nbsp;&nbsp;// 生成小王<BR>&nbsp;&nbsp;&nbsp;小王 w = new 小王();<BR>&nbsp;&nbsp;&nbsp;// 生成小账<BR>&nbsp;&nbsp;&nbsp;小张 z = new 小张();</P>
<P>&nbsp;&nbsp;&nbsp;// 指定监视<BR>&nbsp;&nbsp;&nbsp;z.PlayGame += new PlayGameHandler(w.扣钱);</P>
<P>&nbsp;&nbsp;&nbsp;// 开始玩游戏<BR>&nbsp;&nbsp;&nbsp;z.玩游戏();</P>
<P>&nbsp;&nbsp;&nbsp;Console.WriteLine("场景结束...");<BR>&nbsp;&nbsp;&nbsp;Console.ReadLine();<BR>&nbsp;&nbsp;}<BR>&nbsp;}</P>
<P>&nbsp;</P>
<P>&nbsp;// 负责扣钱的人<BR>&nbsp;public class 小王<BR>&nbsp;{<BR>&nbsp;&nbsp;public 小王()<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine("生成小王...");<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public void 扣钱(object sender,EventArgs e)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine("小王：好小子，上班时间胆敢玩游戏...");<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine("小王：看看你小子有多少钱...");<BR>&nbsp;&nbsp;&nbsp;小张 f = (小张)sender;<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine("小张的钱： " + f.钱.ToString());<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine("开始扣钱......");<BR>&nbsp;&nbsp;&nbsp;System.Threading.Thread.Sleep(500);<BR>&nbsp;&nbsp;&nbsp;f.钱 = f.钱 - 500;<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine("扣完了....现在小张还剩下：" + f.钱.ToString());<BR>&nbsp;&nbsp;}<BR>&nbsp;}</P>
<P>&nbsp;// 如果玩游戏，则引发事件<BR>&nbsp;public class 小张<BR>&nbsp;{<BR>&nbsp;&nbsp;// 先定义一个事件，这个事件表示“小张”在玩游戏。<BR>&nbsp;&nbsp;public event PlayGameHandler PlayGame;<BR>&nbsp;&nbsp;// 保存小张钱的变量<BR>&nbsp;&nbsp;private int m_Money;</P>
<P>&nbsp;&nbsp;public 小张()<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine("生成小张....");<BR>&nbsp;&nbsp;&nbsp;m_Money = 1000; // 构造函数，初始化小张的钱。<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public int 钱 // 此属性可以操作小张的钱。<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;get<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;return m_Money;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;set<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;m_Money = value;<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;public void 玩游戏()<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine("小张开始玩游戏了.....");<BR>&nbsp;&nbsp;&nbsp;Console.WriteLine("小张:CS好玩，哈哈哈！ 我玩.....");<BR>&nbsp;&nbsp;&nbsp;System.Threading.Thread.Sleep(500);<BR>&nbsp;&nbsp;&nbsp;System.EventArgs e = new EventArgs();<BR>&nbsp;&nbsp;&nbsp;OnPlayGame(e);<BR>&nbsp;&nbsp;}</P>
<P>&nbsp;&nbsp;protected virtual void OnPlayGame(EventArgs e)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;if(PlayGame != null)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;PlayGame(this,e);<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}<BR>&nbsp;}</P>
<P>&nbsp;// 定义委托处理程序<BR>&nbsp;public delegate void PlayGameHandler(object sender,System.EventArgs e);</P>
<P>}<BR></P><img src ="http://www.blogjava.net/Microhelp/aggbug/13062.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-09-15 12:33 <a href="http://www.blogjava.net/Microhelp/articles/13062.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET中使用JavaScript</title><link>http://www.blogjava.net/Microhelp/articles/12864.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Tue, 13 Sep 2005 05:41:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/12864.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/12864.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/12864.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/12864.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/12864.html</trackback:ping><description><![CDATA[<FONT color=#000080><FONT face=Arial><STRONG>1、一个MessageBox的例子<BR></STRONG><BR></FONT></FONT>
<CENTER>
<TABLE>
<TBODY>
<TR bgColor=#cccccc>
<TD width=820><FONT face=Arial color=#000080>public static void MessageBox( System.Web.UI.Page page, string msg )<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;StringBuilder StrScript = new StringBuilder(); <BR>&nbsp;&nbsp;&nbsp;StrScript.Append( "&lt;script language=javascript&gt;" );<BR>&nbsp;&nbsp;&nbsp;StrScript.Append( "alert('"+ msg +"');" ); <BR>&nbsp;&nbsp;&nbsp;StrScript.Append( "&lt;/script&gt;" ); <BR>&nbsp;&nbsp;&nbsp;if ( ! page.IsStartupScriptRegistered( "MessageBox" ) )<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;page.RegisterStartupScript( "MessageBox", StrScript.ToString() );<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;}</FONT></TD></TR></TBODY></TABLE><BR></CENTER><FONT color=#000080><FONT face=Arial><STRONG>2、DataGrid删除的确认：</STRONG><BR>在ItemDataBound事件中加入如下代码：<BR></FONT></FONT>
<CENTER>
<TABLE>
<TBODY>
<TR bgColor=#cccccc>
<TD width=820><FONT face=Arial color=#000080>LinkButton delLink = new LinkButton();<BR>&nbsp;&nbsp;&nbsp;if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;delLink = (LinkButton)(e.Item.Cells[0].Controls[0]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;delLink.Attributes.Add("onClick","Javascript:return confirm('Are you sure to delete the record ?');");<BR>&nbsp;&nbsp;&nbsp;}</FONT></TD></TR></TBODY></TABLE></CENTER><img src ="http://www.blogjava.net/Microhelp/aggbug/12864.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-09-13 13:41 <a href="http://www.blogjava.net/Microhelp/articles/12864.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个功能齐全的DataGrid分页例子(转)</title><link>http://www.blogjava.net/Microhelp/articles/10668.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Mon, 22 Aug 2005 02:39:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/10668.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/10668.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/10668.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/10668.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/10668.html</trackback:ping><description><![CDATA[<P><B>来自：<A href="http://dotnet.aspx.cc/ShowDetail.aspx?id=B12283DE-DB20-4322-ACCC-12724442808A">http://dotnet.aspx.cc/ShowDetail.aspx?id=B12283DE-DB20-4322-ACCC-12724442808A</A><BR><BR><FONT color=#006400>C#版本</FONT></B><FONT color=#006400> <B><A href="http://dotnet.aspx.cc/Exam/DataGridPaging/DataGridPaging.aspx" target=_blank>例子</A></B></FONT></P>
<P><B>DataGridPaging.aspx</B></P><XMP><%@ Page language="c#" EnableViewState = "true" Codebehind="DataGridPaging.aspx.cs"
 AutoEventWireup="false" Inherits="eMeng.Exam.DataGridPaging.DataGridPaging" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" runat="server">
<asp:datagrid id="MyDataGrid" runat="server" AutoGenerateColumns="False"
	HorizontalAlign="Center" AlternatingItemStyle-BackColor="#eeeeee"
	HeaderStyle-BackColor="#aaaadd" Font-Size="8pt" Font-Name="Verdana"
	CellSpacing="0" CellPadding="3" GridLines="Both" BorderWidth="1"
	BorderColor="black" OnPageIndexChanged="MyDataGrid_Page" PagerStyle-HorizontalAlign="Right"
	PagerStyle-Mode="NumericPages" PageSize="5" AllowPaging="True">
  <AlternatingItemStyle BackColor="#EEEEEE"></AlternatingItemStyle>
  <HeaderStyle BackColor="#AAAADD" Font-Bold="True" HorizontalAlign="Center"></HeaderStyle>
  <PagerStyle HorizontalAlign="Right" Mode="NumericPages"></PagerStyle>
  <Columns>
  <asp:BoundColumn HeaderText="标题" DataField="Title" HeaderStyle-Width="480px">
  </asp:BoundColumn>
  <asp:BoundColumn HeaderText="发表日期" DataField="CreateDate" DataFormatString="{0:yyyy-MM-dd hh:mm:ss}">
  </asp:BoundColumn>
  </Columns>
</asp:datagrid>
<p style="FONT-SIZE:9pt" align="center">
  <asp:label id="lblPageCount" runat="server"></asp:label>&nbsp;
  <asp:label id="lblCurrentIndex" runat="server"></asp:label>
  <asp:linkbutton id="btnFirst" onclick="PagerButtonClick" runat="server" Font-Name="verdana"
  	Font-size="8pt" ForeColor="navy" CommandArgument="0"></asp:linkbutton>&nbsp;
  <asp:linkbutton id="btnPrev" onclick="PagerButtonClick" runat="server" Font-Name="verdana"
  	Font-size="8pt" ForeColor="navy" CommandArgument="prev"></asp:linkbutton>&nbsp;
  <asp:linkbutton id="btnNext" onclick="PagerButtonClick" runat="server" Font-Name="verdana"
  	Font-size="8pt" ForeColor="navy" CommandArgument="next"></asp:linkbutton>&nbsp;
  <asp:linkbutton id="btnLast" onclick="PagerButtonClick" runat="server" Font-Name="verdana"
  	Font-size="8pt" ForeColor="navy" CommandArgument="last"></asp:linkbutton>
</p>
</form>
</body>
</HTML>
</XMP>
<P><B>DataGridPaging.aspx.cs</B></P><XMP>using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace eMeng.Exam.DataGridPaging
{
/// <summary>
/// DataGridPaging 的摘要说明。
/// </summary>
public class DataGridPaging : System.Web.UI.Page
{
 protected System.Web.UI.WebControls.DataGrid MyDataGrid;
 protected System.Web.UI.WebControls.Label lblPageCount;
 protected System.Web.UI.WebControls.Label lblCurrentIndex;
 protected System.Web.UI.WebControls.LinkButton btnFirst;
 protected System.Web.UI.WebControls.LinkButton btnPrev;
 protected System.Web.UI.WebControls.LinkButton btnNext;
 protected System.Web.UI.WebControls.LinkButton btnLast;
 private OleDbConnection cn = new OleDbConnection();

private void Page_Load(object sender, System.EventArgs e)
{
  // 在此处放置用户代码以初始化页面
  btnFirst.Text = "最首页";
  btnPrev.Text = "前一页";
  btnNext.Text = "下一页";
  btnLast.Text = "最后页";
  OpenDatabase();
  BindGrid();
}
private void OpenDatabase()
{
 cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("xxxx.mdb");
 cn.Open();
}
private void ShowStats()
{
 lblCurrentIndex.Text = "第 " + (MyDataGrid.CurrentPageIndex + 1).ToString() + " 页";
 lblPageCount.Text = "总共 " + MyDataGrid.PageCount.ToString() + " 页";
}

public void PagerButtonClick(object sender, EventArgs e)
{
 string arg = ((LinkButton)sender).CommandArgument.ToString();
 switch(arg)
 {
  case "next":
   if (MyDataGrid.CurrentPageIndex < (MyDataGrid.PageCount - 1))
   {
    MyDataGrid.CurrentPageIndex += 1;
   }
   break;
  case "prev":
   if (MyDataGrid.CurrentPageIndex > 0)
   {
    MyDataGrid.CurrentPageIndex -= 1;
   }
   break;
  case "last":
   MyDataGrid.CurrentPageIndex = (MyDataGrid.PageCount - 1);
   break;
  default:
   MyDataGrid.CurrentPageIndex = System.Convert.ToInt32(arg);
   break;
 }
 BindGrid();
 ShowStats();
}
public void BindGrid()
{
 OleDbConnection myConnection = cn;
 DataSet ds  = new DataSet();
 OleDbDataAdapter adapter  = new OleDbDataAdapter("Select Title,CreateDate from Document", myConnection);
 adapter.Fill(ds, "Document");
 MyDataGrid.DataSource = ds.Tables["Document"].DefaultView;
 MyDataGrid.DataBind();
 ShowStats();
}
public void MyDataGrid_Page(object sender, DataGridPageChangedEventArgs e)
{
 int startIndex ;
 startIndex = MyDataGrid.CurrentPageIndex * MyDataGrid.PageSize;
 MyDataGrid.CurrentPageIndex = e.NewPageIndex;
 BindGrid();
 ShowStats();
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN：该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion
}
}

</XMP>
<P><B><FONT color=#006400>VB.NET版本</FONT></B></P>
<P>DataGridPaging.aspx</P><XMP><%@ Page Language="vb" AutoEventWireup="false" Codebehind="DataGridPaging.aspx.vb" Inherits="DataGridPaging"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
    <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
    <meta content="JavaScript" name="vs_defaultClientScript">
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
  </HEAD>
  <body MS_POSITIONING="GridLayout">
    <form id="Form1" runat="server">
      <asp:datagrid id="MyDataGrid" runat="server" AlternatingItemStyle-BackColor="#eeeeee"
	   HeaderStyle-BackColor="#aaaadd" Font-Size="8pt" Font-Name="Verdana" CellSpacing="0"
	    CellPadding="3" GridLines="Both" BorderWidth="1" BorderColor="black"
		 OnPageIndexChanged="MyDataGrid_Page" PagerStyle-HorizontalAlign="Right"
		  PagerStyle-Mode="NumericPages" PageSize="5" AllowPaging="True">
        <AlternatingItemStyle BackColor="#EEEEEE"></AlternatingItemStyle>
        <HeaderStyle BackColor="#AAAADD"></HeaderStyle>
        <PagerStyle HorizontalAlign="Right" Mode="NumericPages"></PagerStyle>
      </asp:datagrid>
      <p style="font-size:9pt">
        <asp:label id="lblPageCount" runat="server"></asp:label>&nbsp;
        <asp:label id="lblCurrentIndex" runat="server"></asp:label>
        <asp:linkbutton id="btnFirst" onclick="PagerButtonClick" runat="server"
		 Font-Name="verdana" Font-size="8pt" ForeColor="navy" CommandArgument="0">
		 </asp:linkbutton>&nbsp;
        <asp:linkbutton id="btnPrev" onclick="PagerButtonClick" runat="server"
		 Font-Name="verdana" Font-size="8pt" ForeColor="navy" CommandArgument="prev">
		 </asp:linkbutton>&nbsp;
        <asp:linkbutton id="btnNext" onclick="PagerButtonClick" runat="server"
		 Font-Name="verdana" Font-size="8pt" ForeColor="navy" CommandArgument="next">
		 </asp:linkbutton>&nbsp;
        <asp:linkbutton id="btnLast" onclick="PagerButtonClick" runat="server"
		 Font-Name="verdana" Font-size="8pt" ForeColor="navy" CommandArgument="last">
		 </asp:linkbutton>
      </p>
    </form>
  </body>
</HTML>
</XMP>
<P>DataGridPaging.aspx.vb</P><XMP>Imports System.Data.SqlClient
Imports System.Data
Imports System.Web.UI

Public Class DataGridPaging
  Inherits System.Web.UI.Page

  Protected WithEvents MyDataGrid As System.Web.UI.WebControls.DataGrid
  Protected WithEvents btnFirst As System.Web.UI.WebControls.LinkButton
  Protected WithEvents btnPrev As System.Web.UI.WebControls.LinkButton
  Protected WithEvents btnNext As System.Web.UI.WebControls.LinkButton
  Protected WithEvents btnLast As System.Web.UI.WebControls.LinkButton
  Protected WithEvents lblCurrentIndex As System.Web.UI.WebControls.Label
  Protected WithEvents lblPageCount As System.Web.UI.WebControls.Label
  Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid

#Region " Web Form Designer Generated Code "

  'This call is required by the Web Form Designer.
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

  End Sub

  Private Sub Page_Init(ByVal sender As System.Object,_
   ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
  End Sub

#End Region

  Private Sub Page_Load(ByVal sender As System.Object,_
   ByVal e As System.EventArgs) Handles MyBase.Load
    btnFirst.Text = "最首页"
    btnPrev.Text = "前一页"
    btnNext.Text = "下一页"
    btnLast.Text = "最后页"
    OpenDatabase()
    BindGrid()
  End Sub


  Sub MyDataGrid_Page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
    Dim startIndex As Integer
    startIndex = MyDataGrid.CurrentPageIndex * MyDataGrid.PageSize
    MyDataGrid.CurrentPageIndex = e.NewPageIndex
    BindGrid()
    ShowStats()
  End Sub

  Sub BindGrid()
    Dim myConnection As SqlConnection = cn
    Dim ds As DataSet = New DataSet()
    Dim adapter As SqlDataAdapter = New SqlDataAdapter("Select * from Orders", myConnection)
    adapter.Fill(ds, "Orders")
    MyDataGrid.DataSource = ds.Tables("Orders").DefaultView
    MyDataGrid.DataBind()
    ShowStats()

  End Sub

  Sub PagerButtonClick(ByVal sender As Object, ByVal e As EventArgs)
    'used by external paging UI
    Dim arg As String = sender.CommandArgument

    Select Case arg
      Case "next"
        If (MyDataGrid.CurrentPageIndex < (MyDataGrid.PageCount - 1)) Then
          MyDataGrid.CurrentPageIndex += 1
        End If
      Case "prev"
        If (MyDataGrid.CurrentPageIndex > 0) Then
          MyDataGrid.CurrentPageIndex -= 1
        End If
      Case "last"
        MyDataGrid.CurrentPageIndex = (MyDataGrid.PageCount - 1)
      Case Else
        'page number
        MyDataGrid.CurrentPageIndex = System.Convert.ToInt32(arg)
    End Select
    BindGrid()
    ShowStats()
  End Sub

  Sub ShowStats()
    lblCurrentIndex.Text = "第 " + (MyDataGrid.CurrentPageIndex + 1).ToString() + " 页"
    lblPageCount.Text = "总共 " + MyDataGrid.PageCount.ToString() + " 页"
  End Sub

	Public cn As New SqlClient.SqlConnection()
  Public Sub OpenDatabase()
    cn.ConnectionString = "Server=.;Database=NorthWind;User Id=sa;Password=;"
    cn.Open()
  End Sub
End Class
</XMP>
<HR color=red SIZE=1>

<P><B><FONT color=#006400>方法2：完全后代码写法：</FONT><A href="http://dotnet.aspx.cc/Exam/DataGridPaging/DataGridPaging2.aspx" target=_blank>例子</A></B></P>
<P>DataGridPaging2.aspx</P><XMP><%@ Page language="c#" EnableViewState = "true"  Codebehind="DataGridPaging2.aspx.cs" AutoEventWireup="false"
 Inherits="eMeng.Exam.DataGridPaging2.DataGridPaging2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
  <TITLE>功能齐全的分页的例子【2】</TITLE>
  <meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
  <meta content="JavaScript" name="vs_defaultClientScript">
  <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
  <form id="Form1" runat="server">
    <asp:datagrid id="MyDataGrid" runat="server" AutoGenerateColumns="False" HorizontalAlign="Center"
     AlternatingItemStyle-BackColor="#eeeeee" HeaderStyle-BackColor="#aaaadd" Font-Size="8pt"
      Font-Name="Verdana" CellSpacing="0" CellPadding="3" GridLines="Both" BorderWidth="1"
       BorderColor="black" PagerStyle-HorizontalAlign="Right" PagerStyle-Mode="NumericPages"
        PageSize="5" AllowPaging="True">
      <AlternatingItemStyle BackColor="#EEEEEE"></AlternatingItemStyle>
      <HeaderStyle BackColor="#AAAADD" Font-Bold="True" HorizontalAlign="Center"></HeaderStyle>
      <PagerStyle HorizontalAlign="Right" Mode="NumericPages"></PagerStyle>
      <Columns>
        <asp:BoundColumn HeaderText="标题" DataField="Title" HeaderStyle-Width="480px"></asp:BoundColumn>
        <asp:BoundColumn HeaderText="发表日期" DataField="CreateDate" 
        	DataFormatString="{0:yyyy-MM-dd hh:mm:ss}"></asp:BoundColumn>
      </Columns>
    </asp:datagrid>
    <p align="center">
      <asp:label id="lblPageCount" runat="server" Font-Size="9pt" Font-Bold="True"></asp:label>&nbsp;
      <asp:label id="lblCurrentIndex" runat="server" Font-Size="9pt" Font-Bold="True"></asp:label>
      <asp:linkbutton id="btnFirst" runat="server" Font-size="9pt" ForeColor="navy" CommandArgument="0"/>&nbsp;
      <asp:linkbutton id="btnPrev" runat="server" Font-size="9pt" ForeColor="navy" CommandArgument="prev"/>&nbsp;
      <asp:linkbutton id="btnNext" runat="server" Font-size="9pt" ForeColor="navy" CommandArgument="next"/>&nbsp;
      <asp:linkbutton id="btnLast" runat="server" Font-size="9pt" ForeColor="navy" CommandArgument="last"/>
    </p>
  </form>
</body>
</HTML>
</XMP>
<P>DataGridPaging2.aspx.cs</P><XMP>using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace eMeng.Exam.DataGridPaging2
{
/// <summary>
/// DataGridPaging 的摘要说明。
/// </summary>
public class DataGridPaging2 : System.Web.UI.Page
{
 protected System.Web.UI.WebControls.DataGrid MyDataGrid;
 protected System.Web.UI.WebControls.Label lblPageCount;
 protected System.Web.UI.WebControls.Label lblCurrentIndex;
 protected System.Web.UI.WebControls.LinkButton btnFirst;
 protected System.Web.UI.WebControls.LinkButton btnPrev;
 protected System.Web.UI.WebControls.LinkButton btnNext;
 protected System.Web.UI.WebControls.LinkButton btnLast;
 private OleDbConnection cn = new OleDbConnection();

 private void Page_Load(object sender, System.EventArgs e)
 {
  // 在此处放置用户代码以初始化页面
  btnFirst.Text = "最首页";
  btnPrev.Text = "前一页";
  btnNext.Text = "下一页";
  btnLast.Text = "最后页";
  OpenDatabase();
  BindGrid();
 }
 private void OpenDatabase()
 {
  cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
  	 + HttpContext.Current.Server.MapPath("../../aspxWeb.mdb.ascx");
  cn.Open();
 }
 private void ShowStats()
 {
  lblCurrentIndex.Text = "第 " + (MyDataGrid.CurrentPageIndex + 1).ToString() + " 页";
  lblPageCount.Text = "总共 " + MyDataGrid.PageCount.ToString() + " 页";
 }

 public void PagerButtonClick(object sender, EventArgs e)
 {
  string arg = ((LinkButton)sender).CommandArgument.ToString();
  switch(arg)
  {
   case "next":
    if (MyDataGrid.CurrentPageIndex < (MyDataGrid.PageCount - 1))
    {
     MyDataGrid.CurrentPageIndex += 1;
    }
    break;
   case "prev":
    if (MyDataGrid.CurrentPageIndex > 0)
    {
     MyDataGrid.CurrentPageIndex -= 1;
    }
    break;
   case "last":
    MyDataGrid.CurrentPageIndex = (MyDataGrid.PageCount - 1);
    break;
   default:
    MyDataGrid.CurrentPageIndex = System.Convert.ToInt32(arg);
    break;
  }
  BindGrid();
  ShowStats();
 }
 public void BindGrid()
 {
  OleDbConnection myConnection = cn;
  DataSet ds  = new DataSet();
  OleDbDataAdapter adapter  = new OleDbDataAdapter("Select Title,CreateDate from Document", myConnection);
  adapter.Fill(ds, "Document");
  MyDataGrid.DataSource = ds.Tables["Document"].DefaultView;
  MyDataGrid.DataBind();
  ShowStats();
 }
 
#region Web Form Designer generated code
 override protected void OnInit(EventArgs e)
 {
  //
  // CODEGEN：该调用是 ASP.NET Web 窗体设计器所必需的。
  //
  InitializeComponent();
  base.OnInit(e);
 }

 /// <summary>
 /// 设计器支持所需的方法 - 不要使用代码编辑器修改
 /// 此方法的内容。
 /// </summary>
 private void InitializeComponent()
 {
  this.MyDataGrid.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.OnPageIndexChanged);
  this.btnFirst.Click += new System.EventHandler(this.PagerButtonClick);
  this.btnPrev.Click += new System.EventHandler(this.PagerButtonClick);
  this.btnNext.Click += new System.EventHandler(this.PagerButtonClick);
  this.btnLast.Click += new System.EventHandler(this.PagerButtonClick);
  this.Load += new System.EventHandler(this.Page_Load);

 }
#endregion

 private void OnPageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
 {
 int startIndex ;
  startIndex = MyDataGrid.CurrentPageIndex * MyDataGrid.PageSize;
  MyDataGrid.CurrentPageIndex = e.NewPageIndex;
  BindGrid();
  ShowStats();
 }
}
}
</XMP><img src ="http://www.blogjava.net/Microhelp/aggbug/10668.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-08-22 10:39 <a href="http://www.blogjava.net/Microhelp/articles/10668.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET之国际化</title><link>http://www.blogjava.net/Microhelp/articles/9838.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Thu, 11 Aug 2005 09:33:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/9838.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/9838.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/9838.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/9838.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/9838.html</trackback:ping><description><![CDATA[<P><FONT face="Courier New">ASP.NET的国际化思想和Java等语言基本相同。都是通过资源文件查找相应的内容。<BR>要知道ASP.NET如何国际化，让我们从后面说起。<BR>一、原理<BR></FONT><FONT face="Courier New"><SPAN class=lang style="DISPLAY: none">我们事实上是通过ResourceManager的<STRONG>GetString</STRONG>方法来获得资源的。<BR></SPAN><B>public virtual </B></FONT><A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemstringclasstopic.htm"><FONT face="Courier New">string</FONT></A><FONT face="Courier New"><B> GetString(</B><BR><B>&nbsp;&nbsp; </B></FONT><A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemstringclasstopic.htm"><FONT face="Courier New">string</FONT></A><FONT face="Courier New"><B> </B><I><A class=synParam onclick=showTip(this) href="">name</A></I><B>,</B><BR><B>&nbsp;&nbsp; </B></FONT><A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemglobalizationcultureinfoclasstopic.htm"><FONT face="Courier New">CultureInfo</FONT></A><FONT face="Courier New"><B> </B><I><A class=synParam onclick=showTip(this) href="">culture</A></I><BR></FONT><STRONG><FONT face="Courier New">);<BR></FONT></STRONG><A class=synParam onclick=showTip(this) href=""><EM><FONT face="Courier New">name</FONT></EM></A><FONT face="Courier New">是资源的ID.</FONT><A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemglobalizationcultureinfoclasstopic.htm"><FONT face="Courier New">CultureInfo</FONT></A><FONT face="Courier New">是一个用来表示文化的类。<BR><BR>可以用如下方法初始化</FONT><A class=synParam onclick=showTip(this) href=""><EM><FONT face="Courier New">culture</FONT></EM></A><BR><STRONG><FONT face="Courier New">public static </FONT></STRONG><A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemglobalizationcultureinfoclasstopic.htm"><FONT face="Courier New">CultureInfo</FONT></A><FONT face="Courier New"><B> CreateSpecificCulture(</B><BR><B>&nbsp;&nbsp; </B></FONT><A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemstringclasstopic.htm"><FONT face="Courier New">string</FONT></A><FONT face="Courier New"><B> </B><I><A class=synParam onclick=showTip(this) href="">name</A></I><BR></FONT><FONT face="Courier New"><STRONG>);<BR></STRONG>我们可以初始化一个叫abc的文化CultureInfo.CreateSpecificCulture("abc")<BR>ResourceManager类通过如下的方法来确定资源文件的名字和路径<BR><STRONG>public static </STRONG></FONT><A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemresourcesresourcemanagerclasstopic.htm"><STRONG><FONT face="Courier New">ResourceManager</FONT></STRONG></A><STRONG><FONT face="Courier New"> CreateFileBasedResourceManager(<BR>&nbsp;&nbsp; </FONT></STRONG><A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemstringclasstopic.htm"><STRONG><FONT face="Courier New">string</FONT></STRONG></A><STRONG><FONT face="Courier New"> <I><A class=synParam onclick=showTip(this) href="">baseName</A></I>,<BR>&nbsp;&nbsp; </FONT></STRONG><A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemstringclasstopic.htm"><STRONG><FONT face="Courier New">string</FONT></STRONG></A><STRONG><FONT face="Courier New"> <I><A class=synParam onclick=showTip(this) href="">resourceDir</A></I>,<BR>&nbsp;&nbsp; </FONT></STRONG><A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemtypeclasstopic.htm"><STRONG><FONT face="Courier New">Type</FONT></STRONG></A><FONT face="Courier New"><STRONG> <I><A class=synParam onclick=showTip(this) href="">usingResourceSet</A></I><BR>);</STRONG><BR>CreateFileBasedResourceManager("business","D:\Poi Project\LTS2005\resources\"_<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; +System.IO.Path.DirectorySeparatorChar,null);<BR>表示资源文件的路径是：D:\Poi Project\LTS2005\resources\，文件名是business.*.resources<BR>如果</FONT><A href="ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemglobalizationcultureinfoclasstopic.htm"><FONT face="Courier New">CultureInfo</FONT></A><FONT face="Courier New">是abc那么GetString将在D:\Poi Project\LTS2005\resources\business.abc.resources<BR>文件根据相应的资源ID找到所需要的资源<BR>二：如何制作资源文件<BR>使用 resgen 从文本文件编译资源文件：<BR>“resgen strings.txt”生成一个名为 strings.resources 的文件<BR>resgen 的位置在Microsoft Visual Studio .NET 2003\SDK\v1.1\Bin下<BR>strings.txt的格式如下所示： <BR>－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－<BR><FONT color=#800080>
<CENTER>
<TABLE>
<TBODY>
<TR>
<TD bgColor=#e4e4e4><FONT color=#800080>;提示<BR>promptCulture = 请选择希望用来查看此示例的区域性 ==&gt; <BR>promptName = 请输入您的姓名 ==&gt;</FONT></FONT></FONT> 
<P></P>
<P><FONT face="Courier New" color=#800080>;距离<BR>dist1 = （以英里为单位）==&gt;</FONT></P>
<P><FONT face="Courier New"><FONT color=#800080>;温度量度<BR>degree1 = 以华氏度为单位：<BR>degree2 = -100<BR>degree3 = 140 </P></FONT></FONT></TD></TR>
<TBODY></TBODY></TD></TR></TABLE></CENTER><BR></FONT>－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－－ <BR><FONT size=2>注：我们可以通过<STRONG>CultureInfo</STRONG>关键字在MSDN中查找资源国家代码</FONT><BR>
<P></P></FONT><img src ="http://www.blogjava.net/Microhelp/aggbug/9838.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-08-11 17:33 <a href="http://www.blogjava.net/Microhelp/articles/9838.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET之版本问题</title><link>http://www.blogjava.net/Microhelp/articles/8379.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Mon, 25 Jul 2005 01:30:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/8379.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/8379.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/8379.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/8379.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/8379.html</trackback:ping><description><![CDATA[<STRONG><FONT face=Arial color=#000080 size=4>参考链接<A href="http://www.asp.net/faq/SideBySide.aspx"><FONT face=Arial color=#0000ff size=4>http://www.asp.net/faq/SideBySide.aspx</FONT></A><BR><BR>1.如何查找当前WEB应用程序的.NET版本<BR></FONT></STRONG><FONT face=Arial color=#000080 size=4>在Internet信息服务中，选择你想了解的WEB应用程序<BR><BR><IMG height=480 alt=a.gif src="http://www.blogjava.net/images/blogjava_net/microhelp/net/ASP.NET之版本问题/a.gif" width=640 border=0><BR>鼠标右键点击该应用程序，在弹出菜单中点击"属性"<BR><IMG height=430 alt=b.gif src="http://www.blogjava.net/images/blogjava_net/microhelp/net/ASP.NET之版本问题/b.gif" width=640 border=0><BR>在属性窗口，点击"配置"按钮<BR><IMG height=447 alt=c.gif src="http://www.blogjava.net/images/blogjava_net/microhelp/net/ASP.NET之版本问题/c.gif" width=461 border=0><BR>在应用程序映射窗口中，选择.aspx，并点击编辑按钮<BR><IMG height=455 alt=d.gif src="http://www.blogjava.net/images/blogjava_net/microhelp/net/ASP.NET之版本问题/d.gif" width=406 border=0><BR>在可执行文件文本框中，查看版本目录名。如果版本目录名为v.1.1.4322，则其映射为.NET框架1.1版本，如果目录名为v1.0.3705，则表示应用程序映射为.NET 1.0版本。<BR><IMG height=250 alt=e.gif src="http://www.blogjava.net/images/blogjava_net/microhelp/net/ASP.NET之版本问题/e.gif" width=429 border=0><BR><BR></FONT><FONT face=Arial color=#000080 size=4><STRONG>2.设置不同的WEB应用程序使用指定版本的.NET框架</STRONG><BR></FONT>
<P><FONT face=Arial color=#000080 size=4>每个不同版本的.NET框架都包含ASP.NET IIS注册工具(Aspnet_regiis.exe)。该工具允许管理员指定WEB应用程序运行在不同的.NET框架中。不同版本.NET框架的aspnet_regiis.exe存在于各自的目录下，例如管理员希望指定某个网站使用1.1版本的.NET框架，则必须使用.NET框架1.1所在目录下的aspnet_regiis.exe文件。<BR></FONT></P><BR>
<P><BR><FONT face=Arial color=#000080 size=4>.NET框架1.0版本中的aspnet_regiis.exe位于：<BR></FONT>
<UL>
<LI><FONT face=Arial color=#000080 size=4>C:\WINDOWS\Microsoft.NET\Framework\<STRONG>v1.0.3705</STRONG>\aspnet_regiis<BR><BR>.NET框架1.1版本中的aspnet_regiis.exe位于：<BR></FONT>
<LI><FONT face=Arial color=#000080 size=4>C:\WINDOWS\Microsoft.NET\Framework\<STRONG>v1.1.4322</STRONG>\aspnet_regiis<BR><BR>aspnet_regiis.exe提供两个选项：<BR></FONT><BR>
<LI><FONT face=Arial><FONT size=4><FONT color=#000080><STRONG>–s <PATH></STRONG>指定当前路径及其子目录使用该当前脚本配置<BR></FONT></FONT></FONT>
<LI><FONT face=Arial><FONT size=4><FONT color=#000080><STRONG>–sn <PATH></STRONG>仅指定当前路径使用该脚本配置<BR><BR>路径是指WEB应用程序在IIS中的元数据路径，其形式为 W3SVC/ROOT/{WebSiteNumber}/{Application_Name}. 举例来讲，名为Portal的WEB应用程序在默认WEB站点下，则其路径为 W3SVC/1/ROOT/Portal。</FONT></FONT></FONT></LI></UL>
<P><FONT face=Arial color=#000080 size=4><IMG height=480 alt=f.gif src="http://www.blogjava.net/images/blogjava_net/microhelp/net/ASP.NET之版本问题/f.gif" width=640 border=0><BR>注：你也可以使用名为Metabase Editor的工具来获得应用程序的元路径。可以在微软网站上</FONT><A href="http://support.microsoft.com/default.aspx?scid=kb;en-us;232068" target=_blank><FONT face=Arial color=#000080 size=4>http://support.microsoft.com/default.aspx?scid=kb;en-us;232068.</FONT></A><FONT face=Arial color=#000080 size=4> 下载。<BR>运行"Aspnet_regiis.exe –s W3SVC/1/ROOT/Portal"来指定portal及其子目录的应用程序使用该当前脚本配置。</FONT></P>
<P><FONT face=Arial color=#000080 size=4><IMG height=288 alt=g.gif src="http://www.blogjava.net/images/blogjava_net/microhelp/net/ASP.NET之版本问题/g.gif" width=600 border=0><BR>运行"Aspnet_regiis.exe –sn W3SVC/1/ROOT/Portal"来指定portal使用该脚本配置，不影响其子目录中的应用程序<BR><IMG height=288 alt=h.gif src="http://www.blogjava.net/images/blogjava_net/microhelp/net/ASP.NET之版本问题/h.gif" width=600 border=0></FONT></P><img src ="http://www.blogjava.net/Microhelp/aggbug/8379.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-07-25 09:30 <a href="http://www.blogjava.net/Microhelp/articles/8379.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Asp.net如何打开一个已经存在的工程</title><link>http://www.blogjava.net/Microhelp/articles/7247.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Thu, 07 Jul 2005 02:35:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/7247.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/7247.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/7247.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/7247.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/7247.html</trackback:ping><description><![CDATA[<FONT face=Arial color=#000080 size=4>例如：我的工程在D:\Poi Project\0706目录下。打开sln文件。编辑它可以看到一个url。我的是：</FONT><A href="http://localhost/prjPOI1/prjPOI1.csproj"><FONT face=Arial color=#000080 size=4>http://localhost/prjPOI1/prjPOI1.csproj</FONT></A><FONT face=Arial><FONT color=#000080 size=4>。到IIS下建立一个虚拟目录名字为prjPOI1。路径是D:\Poi Project\0706。这时再双击sln文件即可打开工程。</FONT></FONT><img src ="http://www.blogjava.net/Microhelp/aggbug/7247.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-07-07 10:35 <a href="http://www.blogjava.net/Microhelp/articles/7247.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP.NET WEB FORMS 页面间的传值方法</title><link>http://www.blogjava.net/Microhelp/articles/7118.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Tue, 05 Jul 2005 02:16:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/7118.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/7118.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/7118.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/7118.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/7118.html</trackback:ping><description><![CDATA[<P class=postText align=center><STRONG><FONT face=Arial color=#000080 size=4>ASP.NET WEB FORMS 页面间的传值方法</FONT></STRONG></P>
<P class=postText><FONT face=Arial color=#000080 size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ASP.NET WEB FORMS&nbsp; 给开发者提供了极好的事件驱动开发模式。然而这种简单的应用程序开发模式却给我们带来了一些小问题，举个例子，在传统的ASP应用程序中，你能够通过POST方法很容易的把一个值或多个值从一个页面传送到另一个页面，用同样的方法在ASP.NET中实现有点麻烦。在这里，我们可以通过其他方式来解决这种情形。ASP.NET为我们提供了三种方式，一种是可以通过用QueryString来传送相应的值，再一种是通过session变量来传送相应的值，还有就是通过Server.Transfer方法来实现。下面分别一一介绍：</FONT></P>
<P class=postText><BR><FONT face=Arial><FONT size=4><FONT color=#000080><STRONG>一、使用Querystring</STRONG><BR>Querystring是一种非常简单的传值方式，其缺点就是会把要传送的值显示在浏览器的地址栏中，并且在此方法中不能够传递对象。如果你想传递一个安全性不是那么太重要或者是一个简单的数值时，用此方法最好不过了。下面通过一个小例子来完成传值工作，步骤如下：<BR>1、创建一个web form<BR>2、在新建的web form中放置一个button1，在放置两个TextBox1,TextBox2 <BR>3、为button按钮创建click事件<BR>代码如下：<BR>private void Button1_Click<BR>(object sender, System.EventArgs e)<BR>{<BR>&nbsp;string url;<BR>&nbsp;url="webform2.aspx?name=" + <BR>&nbsp;&nbsp;TextBox1.Text + "&amp;email=" + <BR>&nbsp;&nbsp;TextBox2.Text;<BR>&nbsp;Response.Redirect(url);<BR>}<BR>4、新建一个目标页面命名为webform2<BR>5、在webform2中放置两个Label1,Label2<BR>在webform2的Page_Load中添加如下代码：<BR>private void Page_Load<BR>(object sender, System.EventArgs e)<BR>{<BR>&nbsp;Label1.Text=Request.QueryString["name"];<BR>&nbsp;Label2.Text=Request.QueryString["email"];<BR>}<BR>运行,即可看到传递后的结果了。</FONT></FONT></FONT></P>
<P class=postText><STRONG><FONT face=Arial color=#000080 size=4>二、使用Session变量</FONT></STRONG></P>
<P class=postText><FONT face=Arial color=#000080 size=4>使用Session变量传值是一种最常见的方式了，此中方式不仅可以把值传递到下一个页面，还可以交叉传递到多个页面，直至把Session变量的值removed后，变量才会消失。举个例子看看：<BR>1、创建一个web form<BR>2、在新建的web form中放置一个button1，在放置两个TextBox1,TextBox2 <BR>3、为button按钮创建click事件<BR>代码如下：<BR>private void Button1_Click<BR>(object sender, System.EventArgs e)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Session["name"]=TextBox1.Text;<BR>&nbsp;Session["email"]=TextBox2.Text;<BR>&nbsp;Response.Redirect("webform2.aspx");<BR>}<BR>4、新建一个目标页面命名为webform2<BR>5、在webform2中放置两个Label1,Label2<BR>在webform2的Page_Load中添加如下代码：<BR>private void Page_Load<BR>(object sender, System.EventArgs e)<BR>{<BR>&nbsp;Label1.Text=Session["name"].ToString();<BR>&nbsp;Label2.Text=Session["email"].ToString();<BR>&nbsp;Session.Remove("name");<BR>&nbsp;Session.Remove("email");<BR>}<BR>运行,即可看到传递后的结果了。</FONT></P>
<P class=postText><FONT face=Arial><FONT size=4><FONT color=#000080><STRONG>三、使用Server.Transfer</STRONG><BR>虽然这种方法有点复杂，但也不失为一种在页面传值的方式。<BR>举个例子看看：<BR>1、创建一个web form<BR>2、在新建的web form中放置一个button1，在放置两个TextBox1,TextBox2 <BR>3、为button按钮创建click事件<BR>代码如下：<BR>private void Button1_Click<BR>(object sender, System.EventArgs e)<BR>{<BR>&nbsp;Server.Transfer("webform2.aspx");<BR>}<BR>4、创建过程来返回TextBox1,TextBox2控件的值代码如下：<BR>public string Name<BR>{<BR>&nbsp;get<BR>&nbsp;{<BR>&nbsp;&nbsp;return TextBox1.Text;<BR>&nbsp;}<BR>}</FONT></FONT></FONT></P>
<P class=postText><FONT face=Arial color=#000080 size=4>public string EMail<BR>{<BR>&nbsp;get<BR>&nbsp;{<BR>&nbsp;&nbsp;return TextBox2.Text;<BR>&nbsp;}<BR>}<BR>5、新建一个目标页面命名为webform2<BR>6、在webform2中放置两个Label1,Label2<BR>在webform2的Page_Load中添加如下代码：<BR>private void Page_Load<BR>(object sender, System.EventArgs e)<BR>{<BR>&nbsp;//创建原始窗体的实例<BR>&nbsp;WebForm1 wf1;<BR>&nbsp;//获得实例化的句柄<BR>&nbsp;wf1=(WebForm1)Context.Handler;<BR>&nbsp;Label1.Text=wf1.Name;<BR>&nbsp;Label2.Text=wf1.EMail;</FONT></P>
<P class=postText><FONT face=Arial color=#000080 size=4>}<BR>运行,即可看到传递后的结果了。</FONT></P><img src ="http://www.blogjava.net/Microhelp/aggbug/7118.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-07-05 10:16 <a href="http://www.blogjava.net/Microhelp/articles/7118.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Asp.NET初试(4)</title><link>http://www.blogjava.net/Microhelp/articles/6872.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Wed, 29 Jun 2005 05:43:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/6872.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/6872.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/6872.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/6872.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/6872.html</trackback:ping><description><![CDATA[<P><FONT color=#000080><FONT size=4><FONT face=Arial>DataGrid的使用<BR><BR></FONT></FONT></FONT><FONT face=Arial color=#000080 size=4>&lt;%@ Page Language="C#" AutoEventWireup="True" %&gt;<BR>&lt;%@ Import Namespace="System.Data" %&gt;<BR>&nbsp;<BR>&lt;html&gt;<BR>&nbsp;&nbsp; &lt;script language="C#" runat="server"&gt;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ICollection CreateDataSource() <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DataTable dt = new DataTable();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DataRow dr;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dt.Columns.Add(new DataColumn("ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ", typeof(Int32)));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dt.Columns.Add(new DataColumn("Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ", typeof(string)));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dt.Columns.Add(new DataColumn("Address&nbsp;&nbsp; ", typeof(string)));<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i = 0; i &lt; 9; i++) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dr = dt.NewRow();<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dr[0] = i;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dr[1] = "Name " + i.ToString();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dr[2] = "Address " + i.ToString();<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dt.Rows.Add(dr);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DataView dv = new DataView(dt);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return dv;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void Page_Load(Object sender, EventArgs e) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!IsPostBack) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Load this data only once.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ItemsGrid.DataSource= CreateDataSource();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ItemsGrid.DataBind();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;<BR>&nbsp;&nbsp; &lt;/script&gt;<BR>&nbsp;<BR>&lt;body&gt;<BR>&nbsp;<BR>&nbsp;&nbsp; &lt;form runat=server&gt;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;h3&gt;DataGrid Example&lt;/h3&gt;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;b&gt;Product List&lt;/b&gt;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:DataGrid id="ItemsGrid"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BorderColor="black"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BorderWidth="2"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CellPadding="3"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AutoGenerateColumns="true"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; runat="server"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</FONT><FONT face=Arial color=#000080 size=4>&lt;HeaderStyle BackColor="#00aa0a"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&lt;/HeaderStyle&gt;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/asp:DataGrid&gt;<BR>&nbsp;<BR>&nbsp;&nbsp; &lt;/form&gt;<BR>&nbsp;<BR>&lt;/body&gt;<BR>&lt;/html&gt;</FONT></P><img src ="http://www.blogjava.net/Microhelp/aggbug/6872.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-06-29 13:43 <a href="http://www.blogjava.net/Microhelp/articles/6872.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>NUnit 的使用(1)</title><link>http://www.blogjava.net/Microhelp/articles/6822.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Tue, 28 Jun 2005 08:34:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/6822.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/6822.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/6822.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/6822.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/6822.html</trackback:ping><description><![CDATA[<font color=#000080 size=4>在说NUnit之前，不得不说 一下TDD.<br>1<strong>.TDD介绍</strong><br></font>
<div><font color=#000080 size=4>首先什么是TDD呢?全称应该是Test-Driven Development。Kent Beck在他的&lt;&lt;测试驱动开发 &gt;&gt;(Addison-Wesley Professional,2003)一书中,使用下面2个原则来定义TDD: </font></div>
<div><font color=#000080 size=4>&#183;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 除非你有一个失败的自动测试,永远不要写一单行代码. </font></div>
<div><font color=#000080 size=4>&#183;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 阻止重复 <br><strong>2.NUnit的介绍</strong> </font>
<div><font color=#000080 size=4>NUnit是一个单元测试框架,专门针对于.NET来写的.其实在前面有JUnit(Java),CPPUnit(C++),他们都是xUnit的一员.最初,它是从JUnit而来.现在的版本是2.2.接下来我所用的都是基于这个版本.</font></div>
<div><font color=#000080 size=4>NUnit最初是由James W. Newkirk, Alexei A. Vorontsov 和Philip A. Craig, 后来开发团队逐渐庞大起来.在开发过程中, Kent Beck 和Erich Gamma2位牛人也提供了许多帮助.看来对于NUnit还真是下了一番力气了.J</font></div>
<div><font color=#000080 size=4>&nbsp;NUnit是xUnit家族种的第4个主打产品,完全由C#语言来编写,并且编写时充分利用了许多.NET的特性,比如反射,客户属性等等.</font></div>
<div><font color=#000080 size=4>最重要的一点是它适合于所有.NET语言.</font></div>
<div><font color=#000080 size=4>如果你还没有下载,可以到</font><a href="http://www.nunit.org/"><strong><em><font color=#0000ff size=4>http://www.nunit.org/</font></em></strong></a><font color=#000080 size=4>去下载.<br>下面我们先做一个最简单的例子。<br>打开.net的开发环境，新建一个c#工程。<br>Project－&gt;Add Reference 中添加nunit.framework.dll。<br>添加一个类，内容如下：<br>using System;<br>using NUnit.Framework;</font></div>
<div><font color=#000080 size=4>namespace PoiUnit<br>{<br>&nbsp;/// &lt;summary&gt;<br>&nbsp;/// Summary description for Util.<br>&nbsp;/// &lt;/summary&gt;<br>&nbsp;<br>&nbsp;[TestFixture]<br>&nbsp;public class Util<br>&nbsp;{<br>&nbsp;&nbsp;public Util()<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;//<br>&nbsp;&nbsp;&nbsp;// TODO: Add constructor logic here<br>&nbsp;&nbsp;&nbsp;//<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;[SetUp]<br>&nbsp;&nbsp;public void Setup()<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;// Do something...<br>&nbsp;&nbsp;}</font></div>
<div><font color=#000080 size=4>&nbsp;&nbsp;[Test]<br>&nbsp;&nbsp;public void TestOne()<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;int i = 3;<br>&nbsp;&nbsp;&nbsp;Assert.AreEqual( 3, i );</font></div>
<div><font color=#000080 size=4>&nbsp;&nbsp;}<br>&nbsp;&nbsp;[TearDown]<br>&nbsp;&nbsp;public void TearDown()<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;// Do something...<br>&nbsp;&nbsp;}<br>&nbsp;}<br>}<br></font></div>
</div>
<font color=#000080 size=4>编译。<br>打开Nunit，Open编译好的exe文件。<br><img height=512 alt=1.jpg src="http://www.blogjava.net/images/blogjava_net/microhelp/net/Nunit%20使用/1.jpg" width=756 border=0><br>点击RUN。可以看到绿色的显示。表示测试通过，如果没有通过，将是红色。<br><img height=512 alt=2.jpg src="http://www.blogjava.net/images/blogjava_net/microhelp/net/Nunit%20使用/2.jpg" width=756 border=0></font>&nbsp;<br>在本例中，<font color=#000080 size=4> TestOne是一个简单的测试方法，测试i 是否等于3，结果是肯定的。所以运行完为绿色，表示测试通过。如果将i的值改成4，那么Nunit运行的结果应该为红色</font>
<img src ="http://www.blogjava.net/Microhelp/aggbug/6822.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-06-28 16:34 <a href="http://www.blogjava.net/Microhelp/articles/6822.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Asp.NET初试(3)</title><link>http://www.blogjava.net/Microhelp/articles/6816.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Tue, 28 Jun 2005 07:39:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/6816.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/6816.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/6816.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/6816.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/6816.html</trackback:ping><description><![CDATA[<P><FONT face=Arial color=#000080 size=4>事务控制：form上添加一个Label1和button，将下面代码加入button的click事件。<BR><BR><FONT face="Times New Roman" size=3>string myConnString ="Jet OLEDB:Database Password=;Data Source=\"C:\\db1.mdb\";Password=;Provider=\"Microsoft.Jet.OLEDB.4.0\";User ID=Admin";<BR>&nbsp;&nbsp;&nbsp;OleDbConnection myConnection = new OleDbConnection(myConnString);<BR>&nbsp;&nbsp;&nbsp;myConnection.Open();</FONT></FONT></P>
<P><FONT color=#000080>&nbsp;&nbsp;&nbsp;OleDbCommand myCommand = myConnection.CreateCommand();<BR>&nbsp;&nbsp;&nbsp;OleDbTransaction myTrans;</FONT></P>
<P><FONT face=Arial color=#000080 size=4><FONT face="Times New Roman" size=3>&nbsp;&nbsp;&nbsp;myTrans = myConnection.BeginTransaction(IsolationLevel.ReadCommitted);<BR>&nbsp;&nbsp;&nbsp;myCommand.Connection = myConnection;<BR>&nbsp;&nbsp;&nbsp;myCommand.Transaction = myTrans;<BR>&nbsp;&nbsp;&nbsp;try<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;myCommand.CommandText = "Insert into test (name, address) VALUES ('Liu', 'Japan')";<BR>&nbsp;&nbsp;&nbsp;&nbsp;myCommand.ExecuteNonQuery();<BR>&nbsp;&nbsp;&nbsp;&nbsp;myCommand.CommandText = "Insert into test (name, address) VALUES ('Mark',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Germany')";<BR>&nbsp;&nbsp;&nbsp;&nbsp;myCommand.ExecuteNonQuery();<BR>&nbsp;&nbsp;&nbsp;&nbsp;myTrans.Commit();<BR>&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine("Both records are written to database.");<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;catch(Exception ex)<BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;try<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myTrans.Rollback();<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;catch (OleDbException oex)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (myTrans.Connection != null)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.Label1.Text = this.Label1.Text + oex.GetType() ;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;this.Label1.Text =&nbsp; this.Label1.Text + ex.GetType();<BR>&nbsp;&nbsp;&nbsp;&nbsp;this.Label1.Text = this.Label1.Text+"Neither record was written to database";<BR>&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;finally <BR>&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;myConnection.Close();<BR>&nbsp;&nbsp;&nbsp;}<BR></FONT>点击后即可在test表中加入记录</FONT></P><img src ="http://www.blogjava.net/Microhelp/aggbug/6816.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-06-28 15:39 <a href="http://www.blogjava.net/Microhelp/articles/6816.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Asp.NET初试(2) </title><link>http://www.blogjava.net/Microhelp/articles/6811.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Tue, 28 Jun 2005 07:10:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/6811.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/6811.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/6811.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/6811.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/6811.html</trackback:ping><description><![CDATA[<P><FONT color=#000080 size=4>动态执行sql查询：鉴于图形方式不够灵活，这里使用动态代码重新做上次的内容。<BR>界面上不再需要OleDbConnection和OleDbDataAdapter。只要有一个datagrid。<BR>添加一个按钮。在按钮的点击事件中增加如下代码（myConnString 可以从上次的图形界面的OleDbConnection属性得到,删除部分无用的信息，保留数据源、用户、密码等主要信息）：<BR><BR><FONT color=#000080 size=3>&nbsp;&nbsp; string myConnString ="Jet OLEDB:Database Password=;Data Source=\"C:\\db1.mdb\";<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; Password=;Provider=\"Microsoft.Jet.OLEDB.4.0\";User ID=Admin";<BR><BR>&nbsp;&nbsp;&nbsp;string querySql ="<STRONG><FONT color=#ff0000>select * from test where name &lt;&gt; 'aa'</FONT></STRONG>";&nbsp;<BR></FONT></FONT><FONT color=#000080 size=4><FONT color=#000080 size=3>&nbsp;&nbsp;&nbsp;//新建一个OleDbConnection，一个OleDbDataAdapter<BR>&nbsp;&nbsp;&nbsp;OleDbConnection myConnection = new OleDbConnection(myConnString);<BR>&nbsp;&nbsp;&nbsp;OleDbDataAdapter adapter = new OleDbDataAdapter(querySql,myConnection);<BR>&nbsp;&nbsp;&nbsp;adapter.SelectCommand = new OleDbCommand(querySql, myConnection);<BR>&nbsp;&nbsp;&nbsp;DataSet ds = new DataSet();<BR>&nbsp;&nbsp;&nbsp;this.DataGrid1.DataSource=ds;<BR>&nbsp;&nbsp;&nbsp;adapter.Fill(ds);<BR>&nbsp;&nbsp;&nbsp;this.DataGrid1.DataBind();<BR></FONT>&nbsp; <STRONG>点击按钮之后，就可以看到按照你的Sql得到的检索结果<BR>&nbsp; </STRONG><FONT face=Arial size=3><STRONG>OleDbCommand&nbsp;还支持在查询中使用动态参数。上面的例子经过修改如下</STRONG>：</FONT><BR>&nbsp;<FONT size=2> </FONT><FONT size=3>string myConnString ="Jet OLEDB:Database Password=;Data Source=\"C:\\db1.mdb\";Password=;<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;&nbsp; Provider=\"Microsoft.Jet.OLEDB.4.0\";User ID=Admin";<BR>&nbsp;&nbsp;&nbsp;string querySql ="select * from test where name&nbsp; =<FONT color=#ff0000> @name</FONT>";<BR>&nbsp;&nbsp;&nbsp;//新建一个OleDbConnection，一个OleDbDataAdapter<BR>&nbsp;&nbsp;&nbsp;OleDbConnection myConnection = new OleDbConnection(myConnString);<BR>&nbsp;&nbsp;&nbsp;OleDbDataAdapter adapter = new OleDbDataAdapter(querySql,myConnection);<BR>&nbsp;&nbsp;&nbsp;OleDbCommand myCommand&nbsp; = new OleDbCommand(querySql, myConnection);<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;</FONT><FONT color=#ff0000 size=3>OleDbParameter myParm = new OleDbParameter("@name",OleDbType.VarChar,50);<BR>&nbsp;&nbsp;&nbsp;myParm.Value="Liu";<BR>&nbsp;&nbsp;&nbsp;myCommand.Parameters.Add(myParm );<BR>&nbsp;&nbsp;&nbsp;adapter.SelectCommand =myCommand;<BR></FONT><FONT color=#000080><FONT size=3>&nbsp;&nbsp;DataSet ds = new DataSet();<BR>&nbsp;&nbsp;&nbsp;this.DataGrid1.DataSource=ds;<BR>&nbsp;&nbsp;&nbsp;adapter.Fill(ds,"test");<BR>&nbsp;&nbsp;&nbsp;this.DataGrid1.DataBind();<BR></FONT>&nbsp;<STRONG> <FONT face=Arial size=4>这样点击按钮之后就可以检索到名字是“Liu”的数据</FONT></STRONG></FONT></P></FONT><img src ="http://www.blogjava.net/Microhelp/aggbug/6811.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-06-28 15:10 <a href="http://www.blogjava.net/Microhelp/articles/6811.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Asp.NET初试(1)</title><link>http://www.blogjava.net/Microhelp/articles/6779.html</link><dc:creator>Microhelp</dc:creator><author>Microhelp</author><pubDate>Mon, 27 Jun 2005 09:17:00 GMT</pubDate><guid>http://www.blogjava.net/Microhelp/articles/6779.html</guid><wfw:comment>http://www.blogjava.net/Microhelp/comments/6779.html</wfw:comment><comments>http://www.blogjava.net/Microhelp/articles/6779.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/Microhelp/comments/commentRss/6779.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/Microhelp/services/trackbacks/6779.html</trackback:ping><description><![CDATA[<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT color=#000080><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">环境：</SPAN><SPAN lang=EN-US>.NET 2003 + XP professional + Access 2003</SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT color=#000080><FONT size=4><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 15pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第一步</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：在以上系统及软件安装就绪的情况下，配置</SPAN><SPAN lang=EN-US>IIS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">服务。（注意，如果没有安装</SPAN><SPAN lang=EN-US>FrontPage </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">扩展服务，在安装</SPAN><SPAN lang=EN-US> .Net</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">时会提示。安装提示，在添加删除组件中添加</SPAN><SPAN lang=EN-US>FrontPage</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">扩展服务</SPAN> <SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">即可）</SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT color=#000080><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控制面板－</SPAN><SPAN lang=EN-US>&gt;</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">添加删除程序－</SPAN><SPAN lang=EN-US>&gt;</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">添加删除</SPAN><SPAN lang=EN-US>windows</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">组件</SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT color=#000080><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选择</SPAN><SPAN lang=EN-US>iis</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">服务，安默认安装。</SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT color=#000080><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">管理工具－</SPAN><SPAN lang=EN-US>&gt;Internet </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">信息服务</SPAN><SPAN lang=EN-US>,</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这里可以更改主目录的路径，也可以保持默认值。</SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT color=#000080><FONT size=4><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 15pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第二步</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：在</SPAN><SPAN lang=EN-US>ACCESS</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中建表</SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT color=#000080><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">建立空白数据库，建立表</SPAN><SPAN lang=EN-US>Address</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">（</SPAN><SPAN lang=EN-US>id,name,address</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">）添加两条数据。关闭</SPAN><SPAN lang=EN-US>Access</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT color=#000080><FONT size=4><B style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 16pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">第三步</SPAN></B><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">：打开</SPAN><SPAN lang=EN-US>.Net</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，新建一个工程。</SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT color=#000080><FONT size=4><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">新建工程，</SPAN><SPAN lang=EN-US>Project Types </SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选择</SPAN><SPAN lang=EN-US>c</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">＃，</SPAN><SPAN lang=EN-US>Template</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">选择</SPAN><SPAN lang=EN-US>Asp.NET Web Application(</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这里要注意，第一次使用时会跳出如下的对话框，要安帮助信息注册</SPAN></FONT></FONT></FONT><SPAN lang=EN-US><FONT face=Arial color=#000080 size=4>Asp.net)<BR></FONT><IMG height=119 alt=a.jpg src="http://www.blogjava.net/images/blogjava_net/microhelp/net/asp.net初试/a.jpg" width=638 border=0><IMG height=697 alt=b.jpg src="http://www.blogjava.net/images/blogjava_net/microhelp/net/asp.net初试/b.jpg" width=671 border=0><BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT size=4><FONT color=#000080><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在旁边的</SPAN><SPAN lang=EN-US>Toolbox</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">拖一个按钮。</SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT size=4><FONT color=#000080><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US>data</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">区拖一个</SPAN><SPAN lang=EN-US>oledbdataadapter</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。按照向导如下。</SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><IMG height=446 alt=1.jpg src="http://www.blogjava.net/images/blogjava_net/microhelp/net/asp.net初试/1.jpg" width=500 border=0><IMG height=427 alt=2.jpg src="http://www.blogjava.net/images/blogjava_net/microhelp/net/asp.net初试/2.jpg" width=409 border=0><BR><IMG height=427 alt=3.jpg src="http://www.blogjava.net/images/blogjava_net/microhelp/net/asp.net初试/3.jpg" width=409 border=0><BR><IMG height=446 alt=4.jpg src="http://www.blogjava.net/images/blogjava_net/microhelp/net/asp.net初试/4.jpg" width=500 border=0><BR><IMG height=453 alt=5.jpg src="http://www.blogjava.net/images/blogjava_net/microhelp/net/asp.net初试/5.jpg" width=578 border=0><BR><IMG height=446 alt=6.jpg src="http://www.blogjava.net/images/blogjava_net/microhelp/net/asp.net初试/6.jpg" width=500 border=0><BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT size=4><FONT color=#000080><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">右击</SPAN><SPAN lang=EN-US>oledbdataadapter1</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN><SPAN lang=EN-US>Genertate dataset</SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT size=4><FONT color=#000080><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN lang=EN-US>webform</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中选择</SPAN><SPAN lang=EN-US>datagrid</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。设置</SPAN><SPAN lang=EN-US>datasource</SPAN><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">为</SPAN><SPAN lang=EN-US>dataset1</SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT face=Arial color=#000080 size=4>在按钮的点击事件中增加如下代码：</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt; TEXT-ALIGN: left; mso-layout-grid-align: none" align=left><FONT face=Arial><FONT color=#000080><FONT size=4><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">this</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">.oleDbDataAdapter1.Fill(<SPAN style="COLOR: blue">this</SPAN>.dataSet11);<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT face=Arial><FONT color=#000080><FONT size=4><SPAN lang=EN-US style="FONT-SIZE: 9pt; COLOR: blue; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">this</SPAN><SPAN lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt">.DataGrid1.DataBind();<o:p></o:p></SPAN></FONT></FONT></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN style="FONT-SIZE: 9pt; FONT-FAMILY: 新宋体; mso-hansi-font-family: 'Times New Roman'; mso-font-kerning: 0pt"><FONT face=Arial color=#000080 size=4>运行。点击按钮就可以看到数据表中的数据了。</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><BR></SPAN></P><img src ="http://www.blogjava.net/Microhelp/aggbug/6779.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/Microhelp/" target="_blank">Microhelp</a> 2005-06-27 17:17 <a href="http://www.blogjava.net/Microhelp/articles/6779.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>