<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>清风小荷塘 &#187; 编程</title>
	<atom:link href="http://www.zhukun.net/archives/tag/%e7%bc%96%e7%a8%8b/feed" rel="self" type="application/rss+xml" />
	<link>http://www.zhukun.net</link>
	<description>专注IT领域，分享网络乐趣。</description>
	<lastBuildDate>Fri, 03 Feb 2012 05:50:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>启用SQL Server 2005 Express的sa用户名</title>
		<link>http://www.zhukun.net/archives/3190</link>
		<comments>http://www.zhukun.net/archives/3190#comments</comments>
		<pubDate>Mon, 28 Dec 2009 16:02:54 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[学习]]></category>
		<category><![CDATA[数据库]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://www.zhukun.net/?p=3190</guid>
		<description><![CDATA[在默认情况下，SQL Server 2005 Express是采用集成的Windows安全验证且禁用了sa登录名。为了工作组环境下不使用不方便的Windows集成安全验证，我们要启用SQL Server 2005 Express的混合安全验证，也就是说由SQL Server来验证用户而不是由Windows来验证用户。 1、使用SQL Server Management Studio Express。 当我们启动SQL Server Management Studio Express时，首先它要连接到我们的SQL Server 2005 Express，我们在安装SQL Server 2005 Express时，默认的实例为SQLExpress，服务器名称的组成为：机器名\实例名，因此，本例的服务名称为W2K3-C \SQLEXPRESS（注：安装SQL Server 2005 Express的机器名为W2K3-C）。第一次使用SQL Server Management Studio Express，由于我们必须采用Windows身份验证，这是默认安装时决定的。 2、设置SQL Server 2005 Express的身份验证方式 3、设置sa的密码并启用sa登录名 由于我们不知道sa的密码，所以我们须设置一个！不要关闭这个窗口，接着选择左侧的“状态”，默认情况下，sa登录名是禁用的，因此，我们必须启用sa登录名，选择右侧的登录下的“启用” 最后，我们点击窗口下面的“确定”按钮。好了，到此为止，SQL Server &#8230; <a href="http://www.zhukun.net/archives/3190">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>在默认情况下，SQL Server 2005 Express是采用集成的Windows安全验证且禁用了sa登录名。为了工作组环境下不使用不方便的Windows集成安全验证，我们要启用SQL Server 2005 Express的混合安全验证，也就是说由SQL Server来验证用户而不是由Windows来验证用户。</p>
<p>1、使用SQL Server Management Studio Express。<br />
<img src="/wp-content/uploads/2.jpg" alt="启用SQL Server 2005 Express的sa用户名"><span id="more-3190"></span></p>
<p>当我们启动SQL Server Management Studio Express时，首先它要连接到我们的SQL Server 2005 Express，我们在安装SQL Server 2005 Express时，默认的实例为SQLExpress，服务器名称的组成为：机器名\实例名，因此，本例的服务名称为W2K3-C \SQLEXPRESS（注：安装SQL Server 2005 Express的机器名为W2K3-C）。第一次使用SQL Server Management Studio Express，由于我们必须采用Windows身份验证，这是默认安装时决定的。</p>
<p>2、设置SQL Server 2005 Express的身份验证方式<br />
<img src="/wp-content/uploads/3.jpg" alt="启用SQL Server 2005 Express的sa用户名"></p>
<p><img src="/wp-content/uploads/4.jpg" alt="启用SQL Server 2005 Express的sa用户名"></p>
<p><img src="/wp-content/uploads/5.jpg" alt="启用SQL Server 2005 Express的sa用户名"></p>
<p>3、设置sa的密码并启用sa登录名<br />
<img src="/wp-content/uploads/6.jpg" alt="启用SQL Server 2005 Express的sa用户名"></p>
<p><img src="/wp-content/uploads/7.jpg" alt="启用SQL Server 2005 Express的sa用户名"></p>
<p>由于我们不知道sa的密码，所以我们须设置一个！不要关闭这个窗口，接着选择左侧的“状态”，默认情况下，sa登录名是禁用的，因此，我们必须启用sa登录名，选择右侧的登录下的“启用”<br />
<img src="/wp-content/uploads/8.jpg" alt="启用SQL Server 2005 Express的sa用户名"></p>
<p>最后，我们点击窗口下面的“确定”按钮。好了，到此为止，SQL Server 2005 Express服务器已经可以让sa登录了，不过，要重新启动一下，让配置生效。<br />
<img src="/wp-content/uploads/9.jpg" alt="启用SQL Server 2005 Express的sa用户名"></p>
<p>SQL Server 2005 Express Edition的下载地址：<a href="http://msdn.microsoft.com/zh-cn/express/bb410792.aspx" target="_blank">http://msdn.microsoft.com/zh-cn/express/bb410792.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhukun.net/archives/3190/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>C#连接SQL Server代码</title>
		<link>http://www.zhukun.net/archives/3178</link>
		<comments>http://www.zhukun.net/archives/3178#comments</comments>
		<pubDate>Sun, 20 Dec 2009 16:20:29 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[学习]]></category>
		<category><![CDATA[微软]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://www.zhukun.net/?p=3178</guid>
		<description><![CDATA[C#连接SQL Server程序代码: 1 2 3 4 5 6 7 8 9 10 using System.Data; using System.Data.SqlClient; .. &#160; string str=&#34;Server=YourSQLServer;user id=sa;password=;initial catalog=Northwind;Connect Timeout=30&#34;; SqlConnection objConnection=new SqlConnection&#40;str&#41;; &#160; objConnection.Open&#40;&#41;; .. objConnection.Close&#40;&#41;; 解释: C#连接SQL Server数据库的机制与连接Access的机制没有什么太大的区别,只是改变了Connection对象和连接字符串中的不同参数. 首先,连接SQL Server使用的命名空间不是”System.Data.OleDb”,而是”System.Data.SqlClient”. 其次就是他的连接字符串了,我们一个一个参数来介绍(注意:参数间用分号分隔): “user id=sa”:连接数据库的验证用户名为sa.他还有一个别名”uid”,所以这句我们还可以写成”uid=sa”. “password=”:连接数据库的验证密码为空.他的别名为”pwd”,所以我们可以写为”pwd=”. 这里注意,你的SQL &#8230; <a href="http://www.zhukun.net/archives/3178">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>   C#连接SQL Server程序代码:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="vbnet" style="font-family:monospace;">    using System.<span style="color: #0000FF;">Data</span>;  
    using System.<span style="color: #0000FF;">Data</span>.<span style="color: #0000FF;">SqlClient</span>;  
    ..  
&nbsp;
    <span style="color: #FF8000;">string</span> <span style="color: #0600FF;">str</span><span style="color: #008000;">=</span><span style="color: #808080;">&quot;Server=YourSQLServer;user id=sa;password=;initial catalog=Northwind;Connect Timeout=30&quot;</span>;       
    SqlConnection objConnection<span style="color: #008000;">=</span><span style="color: #FF8000;">new</span> SqlConnection<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">str</span><span style="color: #000000;">&#41;</span>;   
&nbsp;
   objConnection.<span style="color: #0600FF;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;  
   ..  
   <span style="color: #0000FF;">objConnection</span>.<span style="color: #0600FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</pre></td></tr></table></div>

<p>    解释:</p>
<p>    C#连接SQL Server数据库的机制与连接Access的机制没有什么太大的区别,只是改变了Connection对象和连接字符串中的不同参数.<span id="more-3178"></span></p>
<p>    首先,连接SQL Server使用的命名空间不是”System.Data.OleDb”,而是”System.Data.SqlClient”.</p>
<p>    其次就是他的连接字符串了,我们一个一个参数来介绍(注意:参数间用分号分隔):<br />
    “user id=sa”:连接数据库的验证用户名为sa.他还有一个别名”uid”,所以这句我们还可以写成”uid=sa”.<br />
    “password=”:连接数据库的验证密码为空.他的别名为”pwd”,所以我们可以写为”pwd=”.<br />
    这里注意,你的SQL Server必须已经设置了需要用户名和密码来登录,否则不能用这样的方式来登录.如果你的SQL Server设置为Windows登录,那么在这里就不需要使用”user id”和”password”这样的方式来登录,而需要使   用”Trusted_Connection=SSPI”来进行登录.<br />
    “initial catalog=Northwind”:使用的数据源为”Northwind”这个数据库.他的别名为”Database”,本句可以写成”Database=Northwind”.<br />
    “Server=YourSQLServer”:使用名为”YourSQLServer”的服务器.他的别名为”Data Source”,”Address”,”Addr”.如果使用的是本地数据库且定义了实例名,则可以写为”Server=(local)\实例名”;如果是远程服务器,则将”(local)”替换为远程服务器的名称或IP地址.<br />
    “Connect Timeout=30&#8243;:连接超时时间为30秒.</p>
<p>    在这里,建立连接对象用的构造函数为:SqlConnection.C#连接SQL Server数据库完成。</p>
<p>    以上代码还可以简写成：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="vbnet" style="font-family:monospace;">    using System.<span style="color: #0000FF;">Data</span>;  
    using System.<span style="color: #0000FF;">Data</span>.<span style="color: #0000FF;">SqlClient</span>;  
    ..  
&nbsp;
    <span style="color: #0000FF;">SqlConnection</span> objConnection<span style="color: #008000;">=</span><span style="color: #FF8000;">new</span> SqlConnection<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Server=YourSQLServer;user id=sa;password=;initial catalog=Northwind;Connect Timeout=30&quot;</span><span style="color: #000000;">&#41;</span>;   
&nbsp;
   objConnection.<span style="color: #0600FF;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;  
   ..  
   <span style="color: #0000FF;">objConnection</span>.<span style="color: #0600FF;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.zhukun.net/archives/3178/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>秀一下我的毕业设计作品</title>
		<link>http://www.zhukun.net/archives/3201</link>
		<comments>http://www.zhukun.net/archives/3201#comments</comments>
		<pubDate>Thu, 10 Dec 2009 16:02:47 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[记录生活]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[大学]]></category>
		<category><![CDATA[学习]]></category>
		<category><![CDATA[生活]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://www.zhukun.net/?p=3201</guid>
		<description><![CDATA[唉，经过几天几夜没日没夜的辛劳，我终于完成了自己的毕业设计：一套房屋中介管理系统！前段日子里，除了吃饭、睡觉，我无时无刻不在翻书，不在查资料，不在写代码~如今终于大功告成了~ 老实说，一开始我都没有料到自己能写出这套程序来，因为我的C#一直都是自学的，学校没有上过一节关于C#的课程。一开始规划这个程序的时候，我就想着怎么简单怎么写，比如那个综合查询，用了ComboBox、GroupBox、DataGirdView一齐出场，我甚至担心自己能否实现这个功能。没想到，靠着我的知识，对比着书上的代码，居然能成功地实现这些功能，比如点击“五华区”以后，右边马上呈现出五华区的房源信息出来，哎~ 看着自己的作品，真是太有成就感了，就像两年前，我刚买回第一个域名做出来第一个网站的时候，那份自豪感，真是爽到极点！如今这份自豪感又回来了~嘿嘿~高人别笑话我，也别说我自恋，每个人都会有自恋的一面的~哈哈~]]></description>
			<content:encoded><![CDATA[<p>唉，经过几天几夜没日没夜的辛劳，我终于完成了自己的毕业设计：一套房屋中介管理系统！前段日子里，除了吃饭、睡觉，我无时无刻不在翻书，不在查资料，不在写代码~如今终于大功告成了~</p>
<p>老实说，一开始我都没有料到自己能写出这套程序来，因为我的C#一直都是自学的，学校没有上过一节关于C#的课程。一开始规划这个程序的时候，我就想着怎么简单怎么写，比如那个综合查询，用了ComboBox、GroupBox、DataGirdView一齐出场，我甚至担心自己能否实现这个功能。没想到，靠着我的知识，对比着书上的代码，居然能成功地实现这些功能，比如点击“五华区”以后，右边马上呈现出五华区的房源信息出来，哎~ </p>
<p><span id="more-3201"></span></p>
<p>看着自己的作品，真是太有成就感了，就像两年前，我刚买回第一个域名做出来第一个网站的时候，那份自豪感，真是爽到极点！如今这份自豪感又回来了~嘿嘿~高人别笑话我，也别说我自恋，每个人都会有自恋的一面的~哈哈~</p>
<p><a href="/wp-content/uploads/113.jpg" target="_blank"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="我的毕业设计作品:房屋中介管理系统" border="0" alt="我的毕业设计作品:房屋中介管理系统" src="/wp-content/uploads/113.jpg" width="600" height="400" /></a></p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="我的毕业设计作品:房屋中介管理系统" border="0" alt="我的毕业设计作品:房屋中介管理系统" src="/wp-content/uploads/114.jpg" /></p>
<p><a href="/wp-content/uploads/115.jpg" target="_blank"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="我的毕业设计作品:房屋中介管理系统" border="0" alt="我的毕业设计作品:房屋中介管理系统" src="/wp-content/uploads/115.jpg" width="600" height="338" /></a></p>
<p><a href="/wp-content/uploads/116.jpg" target="_blank"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="我的毕业设计作品:房屋中介管理系统" border="0" alt="我的毕业设计作品:房屋中介管理系统" src="/wp-content/uploads/116.jpg" width="600" height="319" /></a></p>
<p><a href="/wp-content/uploads/117.jpg" target="_blank"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="我的毕业设计作品:房屋中介管理系统" border="0" alt="我的毕业设计作品:房屋中介管理系统" src="/wp-content/uploads/117.jpg" width="600" height="528" /></a></p>
<p><a href="/wp-content/uploads/118.jpg" target="_blank"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="我的毕业设计作品:房屋中介管理系统" border="0" alt="我的毕业设计作品:房屋中介管理系统" src="/wp-content/uploads/118.jpg" width="600" height="338" /></a></p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="我的毕业设计作品:房屋中介管理系统" border="0" alt="我的毕业设计作品:房屋中介管理系统" src="/wp-content/uploads/119.jpg" /></p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="我的毕业设计作品:房屋中介管理系统" border="0" alt="我的毕业设计作品:房屋中介管理系统" src="/wp-content/uploads/120.jpg" /></p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="我的毕业设计作品:房屋中介管理系统" border="0" alt="我的毕业设计作品:房屋中介管理系统" src="/wp-content/uploads/121.jpg" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhukun.net/archives/3201/feed</wfw:commentRss>
		<slash:comments>49</slash:comments>
		</item>
		<item>
		<title>ASP编程基础知识（二）</title>
		<link>http://www.zhukun.net/archives/2715</link>
		<comments>http://www.zhukun.net/archives/2715#comments</comments>
		<pubDate>Mon, 19 Oct 2009 20:30:33 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[学习]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://www.zhukun.net/?p=2715</guid>
		<description><![CDATA[10、利用Application对象作计数器的语法 在网页的头部加入 Application.Lock Application(&#34;counter&#34;) = Application(&#34;counter&#34;) + 1 Application.UnLock 在需要显示计数内容的网页的地方，加入下面的语句 response.write Application(&#34;counter&#34;) 11、利用Session对象保护后台管理页面admin.asp，防止未登陆用户进入 第一步、在网站后台网页需要权限保护的所有网页的头部加入下面的代码, &#160;&#160; if session(&#34;admin&#34;)&#60;&#62;&#34;ok&#34; then &#160;&#160; response.redirect&#34;login.asp&#34; &#160;&#160; response.end &#160;&#160; end if 第二步、在网站后台登陆页的检测表单发来的用户名和密码验证部分标准写法 AdmName=Request.Form(&#34;Name&#34;) AdmPass=Request.Form(&#34;Pass&#34;) Set Rs=Server.CreateObject(&#34;ADODB.RecordSet&#34;) SqlStr=&#34;Select * from Admin where name=&#8217;&#34;&#38;AdmName&#38;&#34;&#8217; and pass=&#8217;&#34;&#38;AdmPass&#38;&#34;&#8217;&#34; Rs.Open SqlStr,conn,1,3 &#8230; <a href="http://www.zhukun.net/archives/2715">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>10、利用Application对象作计数器的语法 </p>
<p>在网页的头部加入   <br />Application.Lock    <br />Application(&quot;counter&quot;) = Application(&quot;counter&quot;) + 1    <br />Application.UnLock    <br />在需要显示计数内容的网页的地方，加入下面的语句    <br />response.write Application(&quot;counter&quot;) </p>
<p>11、利用Session对象保护后台管理页面admin.asp，防止未登陆用户进入 </p>
<p> <span id="more-2715"></span>
<p>第一步、在网站后台网页需要权限保护的所有网页的头部加入下面的代码,   <br />&#160;&#160; if session(&quot;admin&quot;)&lt;&gt;&quot;ok&quot; then    <br />&#160;&#160; response.redirect&quot;login.asp&quot;    <br />&#160;&#160; response.end    <br />&#160;&#160; end if </p>
<p>第二步、在网站后台登陆页的检测表单发来的用户名和密码验证部分标准写法   <br />AdmName=Request.Form(&quot;Name&quot;)    <br />AdmPass=Request.Form(&quot;Pass&quot;)     <br />Set Rs=Server.CreateObject(&quot;ADODB.RecordSet&quot;)    <br />SqlStr=&quot;Select * from Admin where name=&#8217;&quot;&amp;AdmName&amp;&quot;&#8217; and pass=&#8217;&quot;&amp;AdmPass&amp;&quot;&#8217;&quot;    <br />Rs.Open SqlStr,conn,1,3 </p>
<p>if Rs.EOF AND RS.BOF then   <br />Response.Redirect(&quot;login.asp&quot;)    <br />response.end    <br />else    <br />session(&quot;admin&quot;)=&quot;ok&quot;    <br />Response.Redirect(&quot;admin.asp&quot;)    <br />response.end    <br />end if </p>
<p>12、分页代码   <br />sql = &quot;select……………………省略了你的从表中取出所有数据的sql语句写法    <br /> Set rs=Server.Createobject(&quot;ADODB.RECORDSET&quot;)    <br /> rs.Open sql, conn, 1, 1    <br /> if not rs.eof then    <br />&#160;&#160;&#160; pages = 30 &#8216;定义每页显示的记录数    <br />&#160;&#160;&#160; rs.pageSize = pages &#8216;定义每页显示的记录数    <br />&#160;&#160;&#160; allPages = rs.pageCount &#8216;计算一共能分多少页    <br />&#160;&#160;&#160; page = Request.QueryString(&quot;page&quot;)&#8217;通过浏览器传递的页数    <br />&#160;&#160;&#160; &#8216;if语句属于基本的排错处理    <br />&#160;&#160;&#160; if isEmpty(page) or Cint(page) &lt; 1 then    <br /> page = 1    <br />&#160;&#160;&#160; elseif Cint(page) &gt; allPages then    <br /> page = allPages     <br />&#160;&#160;&#160; end if    <br />&#160;&#160;&#160; rs.AbsolutePage = page    <br />&#160;&#160;&#160; Do while not rs.eof and pages &gt; 0     <br /> &#8216;这里输出你要的内容………………    <br />&#160;&#160;&#160;&#160; pages = pages &#8211; 1    <br />&#160;&#160;&#160; rs.MoveNext    <br />&#160;&#160;&#160; Loop    <br /> else    <br /> Response.Write(&quot;数据库暂无内容！&quot;)    <br /> End if    <br /> rs.Close    <br /> Set rs = Nothing    <br />&#8216;分页页码连接和跳转页码程序    <br />&lt;form Action=&quot;&quot; Method=&quot;GET&quot;&gt;    <br />&lt;%     <br />If Page &lt;&gt; 1 Then    <br />&#160;&#160; Response.Write &quot;&lt;A HREF=?Page=1&gt;第一页&lt;/A&gt;”    <br />&#160;&#160; Response.Write &quot;&lt;A HREF=?Page=&quot; &amp; (Page-1) &amp; &quot;&gt;上一页&lt;/A&gt;“    <br />End If    <br />If Page &lt;&gt; allPages Then    <br />&#160;&#160; Response.Write &quot;&lt;A HREF=?Page=&quot; &amp; (Page+1) &amp; &quot;&gt;下一页&lt;/A&gt;&quot;    <br />&#160;&#160; Response.Write &quot;&lt;A HREF=?Page=&quot; &amp; allPages &amp; &quot;&gt;最后一页&lt;/A&gt;&quot;    <br />End If    <br />%&gt;    <br />输入页数：&lt;input TYPE=&quot;TEXT&quot; Name=&quot;Page&quot; SIZE=&quot;3&quot;&gt; 页数:&lt;font COLOR=&quot;Red&quot;&gt;&lt;%=Page%&gt;/&lt;%=allPages %&gt;&lt;/font&gt;     <br />&lt;/form&gt;    <br />13、分行列显示图片和产品名称的代码（4列x3行=12个）    <br />&lt;%    <br />Set Rs=Server.CreateObject(&quot;ADODB.RecordSet&quot;)    <br />SqlStr=&quot;select top 12 * from myproduct&quot;    <br />Rs.Open SqlStr,conn,1,1    <br />i=1    <br />%&gt;    <br />&lt;table width=&quot;90%&quot;&#160;&#160; border=&quot;1&quot; cellspacing=&quot;0&quot; sellpadding=&quot;0&quot;&gt;    <br />&lt;tr&gt;    <br />&lt;%&#160; <br />do&#160;&#160; while not rs.eof    <br />%&gt;    <br />&lt;td align=&quot;center&quot;&gt;    <br />&lt;img src=&quot;&lt;%=rs(&quot;imgurl&quot;)%&gt;&quot; width=&quot;52&quot; height=&quot;120&quot;&gt;&lt;br&gt;    <br />&lt;%=rs(&quot;productname&quot;)%&gt;    <br />&lt;/td&gt;    <br />&lt;% if i mod 4=0 then response.write&quot;&lt;/tr&gt;&lt;tr&gt;&quot;    <br />i=i+1    <br />rs.movenext    <br />loop    <br />rs.close    <br />%&gt;    <br />&#160;&#160; &lt;/tr&gt;    <br />&lt;/table&gt; </p>
<p>十四、ASP数据库连接之ACCESS-SQLSERVER   <br />&lt;%    <br />IsSqlData=0&#160;&#160;&#160; ‘定义数据库类别，0为Access数据库，1为SQL数据库    <br />If IsSqlData=0 Then    <br />Access数据库     <br />datapath =&quot;data/&quot;&#160;&#160;&#160; 数据库目录的相对路径    <br />datafile =&quot;data.mdb&quot;&#160;&#160;&#160; 数据库的文件名    <br />c&amp;Server.MapPath(&quot;&quot;&amp;datapath&amp;&quot;&quot;&amp;datafile&amp;&quot;&quot;)    <br />C&amp;server.mappath(&quot;&quot;&amp;datapath&amp;&quot;&quot;&amp;datafile&amp;&quot;&quot;)&amp;&quot;;DRIVER={Microsoft Access Driver (*.mdb)};&quot;    <br />Else    <br />SQL数据库     <br />SqlLocalName =&quot;(local)&quot;&#160;&#160;&#160;&#160; 连接IP&#160;&#160; [ 本地用 (local) 外地用IP ]    <br />SqlUsername =&quot;sa&quot;&#160;&#160;&#160;&#160;&#160;&#160; 用户名    <br />SqlPassword =&quot;1&quot;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; 用户密码    <br />SqlDatabaseName=&quot;data&quot;&#160;&#160;&#160; 数据库名    <br />C &amp; SqlUsername &amp; &quot;; Password=&quot; &amp; SqlPassword &amp; &quot;; Initial Catalog = &quot; &amp; SqlDatabaseName &amp; &quot;; Data Source=&quot; &amp; SqlLocalName &amp; &quot;;&quot;    <br />END IF    <br />On Error Resume Next    <br />Set conn=Server.CreateObject(&quot;ADODB.Connection&quot;)    <br />conn.open ConnStr    <br />If Err Then    <br />err.Clear    <br />Set Conn = Nothing    <br />Response.Write &quot;数据库连接出错，请检查连接字串。&quot;    <br />Response.End    <br />End If    <br />%&gt; </p>
<p>&lt;!&#8211; 判断网址是否合格并处理 &#8211;&gt;   <br />&lt;%    <br />url=trim(request.form(&quot;url&quot;))    <br />if left(url,7)&lt;&gt;&quot;<a href="http://&quot;">http://&quot;</a> then    <br />url=&quot;<a href="http://&quot;&amp;url">http://&quot;&amp;url</a>    <br />end if    <br />%&gt; </p>
<p>&lt;!&#8211; 显示时间为几月几日并处理 &#8211;&gt;   <br />&lt;%    <br />y=Month(date())    <br />r=Day(date())    <br />if len(y)=1 then y=&quot;0&quot; &amp; y    <br />if len(r)=1 then r=&quot;0&quot; &amp; r    <br />Response.Write&#160;&#160; y &amp; &quot;月&quot; &amp; r &amp; &quot;日&quot;     <br />%&gt; </p>
<p>&lt;!&#8211; 限制某些IP访问网站 &#8211;&gt;   <br />&lt;%     <br />url_str=Request.ServerVariables(&quot;REMOTE_ADDR&quot;)    <br />url=split(url_str,&quot;.&quot;)    <br />if url(0)=127 and url(1)=0 and url(2)=0 and url(3)&gt;0 and url(3)&lt;256 then    <br />else    <br />response.Write(url_str)    <br />end if    <br />%&gt; </p>
<p>&lt;!&#8211; 设置文章显示格式 &#8211;&gt;   <br />&lt;%    <br />function HTMLEncode(fString)    <br />if not isnull(fString) then    <br />&#160;&#160;&#160;&#160; fString = replace(fString, &quot;&gt;&quot;, &quot;&gt;&quot;)    <br />&#160;&#160;&#160;&#160; fString = replace(fString, &quot;&lt;&quot;, &quot;&lt;&quot;)    <br />&#160;&#160;&#160;&#160; fString = Replace(fString, CHR(32), &quot; &quot;)    <br />&#160;&#160;&#160;&#160; fString = Replace(fString, CHR(9), &quot; &quot;)    <br />&#160;&#160;&#160;&#160; fString = Replace(fString, CHR(34), &quot;&quot;&quot;)    <br />&#160;&#160;&#160;&#160; fString = Replace(fString, CHR(39), &quot;&#8217;&quot;)    <br />&#160;&#160;&#160;&#160; fString = Replace(fString, CHR(13), &quot;&quot;)    <br />&#160;&#160;&#160;&#160; fString = Replace(fString, CHR(10) &amp; CHR(10), &quot;&lt;/P&gt;&lt;P&gt; &quot;)    <br />&#160;&#160;&#160;&#160; fString = Replace(fString, CHR(10), &quot;&lt;BR&gt; &quot;) </p>
<p>&#160;&#160;&#160;&#160; HTMLEncode = fString   <br />end if    <br />end function    <br />%&gt; </p>
<p>1. ASP与Access数据库连接：   <br />&lt;%    <br />dim conn,mdbfile    <br />mdbfile=server.mappath(&quot;数据库名称.mdb&quot;)    <br />set conn=server.createobject(&quot;adodb.connection&quot;)    <br />conn.open &quot;driver={microsoft access driver     <br />(*.mdb)};uid=admin;pwd=数据库密码;dbq=&quot;&amp;mdbfile    <br />%&gt;    <br />2. ASP与SQL数据库连接：    <br />&lt;%    <br />dim conn    <br />set conn=server.createobject(&quot;ADODB.connection&quot;)    <br />con.open &quot;PROVIDER=SQLOLEDB;DATA     <br />SOURCE=SQL服务器名称或IP地址;UID=sa;PWD=数据库密码;DATABASE=数据库名称    <br />%&gt; </p>
<p>建立记录集对象： </p>
<p>set rs=server.createobject(&quot;adodb.recordset&quot;)   <br />rs.open SQL语句,conn,3,2 </p>
<p>3. SQL常用命令使用方法：   <br />(1) 数据记录筛选：    <br />sql=&quot;select * from 数据表 where 字段名=字段值 order by 字段名 [desc]&quot;    <br />sql=&quot;select * from 数据表 where 字段名 like &#8216;%字段值%&#8217; order by 字段名 [desc]&quot;    <br />sql=&quot;select top 10 * from 数据表 where 字段名 order by 字段名 [desc]&quot;    <br />sql=&quot;select * from 数据表 where 字段名 in (&#8216;值1&#8242;,&#8217;值2&#8242;,&#8217;值3&#8242;)&quot;    <br />sql=&quot;select * from 数据表 where 字段名 between 值1 and 值2&quot; </p>
<p>(2) 更新数据记录：   <br />sql=&quot;update 数据表 set 字段名=字段值 where 条件表达式&quot;    <br />sql=&quot;update 数据表 set 字段1=值1,字段2=值2 …… 字段n=值n where 条件表达式&quot; </p>
<p>(3) 删除数据记录：   <br />sql=&quot;delete from 数据表 where 条件表达式&quot;    <br />sql=&quot;delete from 数据表&quot; (将数据表所有记录删除) </p>
<p>(4) 添加数据记录：   <br />sql=&quot;insert into 数据表 (字段1,字段2,字段3 …) values (值1,值2,值3 …)&quot;    <br />sql=&quot;insert into 目标数据表 select * from 源数据表&quot; (把源数据表的记录添加到目标数据表) </p>
<p>(5) 数据记录统计函数：   <br />AVG(字段名) 得出一个表格栏平均值    <br />COUNT(*|字段名) 对数据行数的统计或对某一栏有值的数据行数统计    <br />MAX(字段名) 取得一个表格栏最大的值    <br />MIN(字段名) 取得一个表格栏最小的值    <br />SUM(字段名) 把数据栏的值相加    <br />引用以上函数的方法：    <br />sql=&quot;select sum(字段名) as 别名 from 数据表 where 条件表达式&quot;    <br />set rs=conn.excute(sql)    <br />用 rs(&quot;别名&quot;) 获取统的计值，其它函数运用同上。 </p>
<p>(6) 数据表的建立和删除：   <br />Create TABLE 数据表名称(字段1 类型1(长度),字段2 类型2(长度) …… ) </p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhukun.net/archives/2715/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>ASP编程基础知识（一）</title>
		<link>http://www.zhukun.net/archives/2707</link>
		<comments>http://www.zhukun.net/archives/2707#comments</comments>
		<pubDate>Fri, 16 Oct 2009 18:02:34 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[学习]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://www.zhukun.net/?p=2707</guid>
		<description><![CDATA[ASP课堂上学到的程序设计,都是按照语法和对象来一点一点的学习的，到最后编程的时候，新手根本想不出来要怎么来组合才能完成一个模块，下面把这些语法按照程序员常用的模块方式组合起来，请大家按照模块来记忆，然后按照模块来应用，不一定要一个一个字母的背下来，关键是用到这些模块的时候能准确的，拿出来，安上去！ 注意下面的标点符号，全部都为英文中的半角符号，如果写成了全角的就一定运行不起来了，切忌切忌…… 1、常用写法 (1)ASP开始结束符语法：&#60;% %&#62; 文件后缀.asp (2)Request.form(&#34;title&#34;) &#8216;获取表单中的一个输入框name叫title的值 (3)Request.querystring(&#34;title&#34;) &#8216;获取连接中的一个参数title=后面的值 (4)dim str str=&#34;我爱你&#34; response.write(str)&#160;&#160; &#8216;向屏幕输出 (5) response.write &#34;ok 程序运行到这里了！&#34; (6) sql=&#34;select * from news&#34; response.write sql &#8216;调试和查看sql语句写法是否正确的语句常用到 (7)Response.Redirect(&#34;login.asp&#34;)&#160;&#160; &#8216;跳转到另外一个页面 (8)response.redirect(&#34;admin.asp&#34;) &#8216;转到后台 (9)Response.end&#160;&#160; &#8216;程序输出截至，不显示该条语句下面的内容了 (10)Response.Write(&#34;&#60;script&#62;alert(&#8216;???！&#8217;)&#60;/script&#62;&#34;)&#8217;弹出提示窗口 2、判断语句 (1)判断表单传来的用户名和密码是否正确，并提示 If&#160;&#160; request(&#34;username&#34;)=&#34;admin&#34; then Response.write&#34;恭喜，你已经登录成功&#34; &#8230; <a href="http://www.zhukun.net/archives/2707">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>ASP课堂上学到的程序设计,都是按照语法和对象来一点一点的学习的，到最后编程的时候，新手根本想不出来要怎么来组合才能完成一个模块，下面把这些语法按照程序员常用的模块方式组合起来，请大家按照模块来记忆，然后按照模块来应用，不一定要一个一个字母的背下来，关键是用到这些模块的时候能准确的，拿出来，安上去！ </p>
<p>注意下面的标点符号，全部都为英文中的半角符号，如果写成了全角的就一定运行不起来了，切忌切忌…… </p>
<p> <span id="more-2707"></span>
<p>1、常用写法    <br />(1)ASP开始结束符语法：&lt;% %&gt; 文件后缀.asp     <br />(2)Request.form(&quot;title&quot;) &#8216;获取表单中的一个输入框name叫title的值     <br />(3)Request.querystring(&quot;title&quot;) &#8216;获取连接中的一个参数title=后面的值 </p>
<p>(4)dim str    <br />str=&quot;我爱你&quot;     <br />response.write(str)&#160;&#160; &#8216;向屏幕输出     <br />(5) response.write &quot;ok 程序运行到这里了！&quot; </p>
<p>(6) sql=&quot;select * from news&quot;    <br />response.write sql     <br />&#8216;调试和查看sql语句写法是否正确的语句常用到 </p>
<p>(7)Response.Redirect(&quot;login.asp&quot;)&#160;&#160; &#8216;跳转到另外一个页面    <br />(8)response.redirect(&quot;admin.asp&quot;) &#8216;转到后台     <br />(9)Response.end&#160;&#160; &#8216;程序输出截至，不显示该条语句下面的内容了     <br />(10)Response.Write(&quot;&lt;script&gt;alert(&#8216;???！&#8217;)&lt;/script&gt;&quot;)&#8217;弹出提示窗口 </p>
<p>2、判断语句    <br />(1)判断表单传来的用户名和密码是否正确，并提示     <br />If&#160;&#160; request(&quot;username&quot;)=&quot;admin&quot; then     <br />Response.write&quot;恭喜，你已经登录成功&quot;     <br />Else     <br />Response.write&quot;对不起，您输入的用户名错误，请返回重输入&quot;     <br />End if </p>
<p>(2)同时判定用户名和密码都正确就转入到后台，否则退回到从新输入页面    <br />If request(&quot;name&quot;)=&quot;admin&quot; and request(&quot;pass&quot;)=&quot;admin&quot; then     <br />Response.redirect&quot;admin.asp&quot;     <br />Else     <br />Response.redirect&quot;login.asp&quot;     <br />End if </p>
<p>(3)变量值和字符串值合起来用&amp;    <br />a=&quot;我&quot;     <br />b=&quot;爱&quot;     <br />c=&quot;你&quot;     <br />response.write a&amp;b&amp;c&amp;&quot;妈妈&quot; </p>
<p>3、循环语句：循环显示6条数据库中的记录    <br />(1)写法1：     <br />do while not rs.eof     <br />response.write&#160;&#160; &quot;&lt;br&gt;&lt;font color=#000000&gt;&quot;&amp;rs(&quot;title&quot;)&amp;&quot;&lt;/font&gt;&lt;br&gt;&quot;     <br />rs.movenext     <br />loop     <br />(2)写法二：     <br />for n=1 to 6     <br />response.write&#160;&#160; rs(&quot;title&quot;)&amp;&quot;&lt;br&gt;&quot;     <br />if&#160;&#160; rs.eof then     <br />&#160;&#160;&#160;&#160;&#160;&#160; exit for &#8216;跳出for循环     <br />else     <br />&#160;&#160;&#160;&#160;&#160;&#160; rs.movenext &#8216;记录集下移一条     <br />end if     <br />next </p>
<p>4、常用变量转换函数    <br />Now() 函数返回系统时间     <br />Date() 函数返回当前系统日期.     <br />CStr(int) 函数转化一个表达式为字符串     <br />CInt(string) 将一个表达式转化为数字类型     <br />Trim(request(&quot;username&quot;)) 函数去掉字符串左右的空格     <br />Left(rs(&quot;title&quot;),10)&amp;&quot;&#8230;&quot; 函数返回字符串左边第10个字符以前的字符（含第length个字符）,一般在限制新闻标题的显示长度的时候用     <br />Len(string) 函数返回字符串的长度. 中文字符长度也计为一     <br />request.serverVariables(&quot;remote_host&quot;)&#8217;取得来访问的IP     <br />mid(str,起始字符,[读取长度])：截取字符串中间子字符串     <br />right(str,nlen)：从右边起截取nlen长度子字符串     <br />Lcase(str)：字符串转成小写     <br />Ucase(str)：字符串转成大写     <br />Ltrim(str)：去除字符串左侧空格     <br />Rtrim(str)：去除字符串右侧空格     <br />replace(str,查找字符串,替代字符串,[起始字符,替代次数,比较方法])：     <br />替换字符串     <br />注：默认值：起始字符 1；替代次数 不限；比较方法 区分大小写（0）     <br />InStr([起始字符,]str,查找字符串[,比较方法])：检测是否包含子字符串 可选参数需同时选 返回起始位置 </p>
<p>5、Access数据库连接代码    <br />(1)方法一：     <br />db=&quot;mydata.mdb&quot; &#8216;如果放在目录中，就要写明&quot;database/mydata.mdb&quot;     <br />Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)     <br />cServer.MapPath(db)     <br />conn.Open connstr </p>
<p>(2)方法二：    <br />&#8216;如果你的服务器采用较老版本Access驱动，请用下面连接方法     <br />db=&quot;mydata.mdb&quot; &#8216;如果放在目录中，就要写明&quot;database/mydata.mdb&quot;     <br />Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)     <br />c &amp; Server.MapPath(db)     <br />conn.Open connstr </p>
<p>6、标准的用Sql语句和asp操作数据的常用写法    <br />包括取全部记录     <br />Set Rs=Server.CreateObject(&quot;ADODB.RecordSet&quot;)     <br />SqlStr=&quot;select * from news&quot;     <br />Rs.Open SqlStr,conn,1,1 &#8216;运行sql语句，把数据提出到rs对象中 </p>
<p>选取几条数据    <br />Set Rs=Server.CreateObject(&quot;ADODB.RecordSet&quot;)     <br />SqlStr=&quot;select top 6 * from news&quot;     <br />Rs.Open SqlStr,conn,1,1 &#8216;运行sql语句，把6条数据提出到rs对象中 </p>
<p>选取一条指定表中id字段数值的数据    <br />Set Rs=Server.CreateObject(&quot;ADODB.RecordSet&quot;)     <br />SqlStr=&quot;select * from news where id=&quot;&amp;request(&quot;id&quot;)     <br />Rs.Open SqlStr,conn,1,1 &#8216;运行sql语句，把6条数据提出到rs对象中 </p>
<p>获取一条表单传过来的数据，然后加入到一个表当中    <br />dim a,b,c,d     <br />a=request.form(&quot;a&quot;)     <br />b=request(&quot;b&quot;)     <br />c=request(&quot;c&quot;)     <br />d=request(&quot;d&quot;)     <br />sqlstr100000=&quot;insert into huiyuanbiao(yonghuming,mima,wenti,daan) values(&#8216;&quot;&amp;a&amp;&quot;&#8217;,'&quot;&amp;b&amp;&quot;&#8217;,'&quot;&amp;c&amp;&quot;&#8217;,'&quot;&amp;d&amp;&quot;&#8217;)&quot;     <br />conn.execute sqlstr100000     <br />response.write&quot;恭喜，新数据加入成功！&quot; </p>
<p>修改一条指定表中id字段数值的数据，用表单传过来的数据替换    <br />dim a,d,e     <br />a=request(&quot;id&quot;)     <br />d=request.form(&quot;d&quot;)     <br />e=request.form(&quot;e&quot;)     <br />sqlstr=&quot;update huiyuanbiao set yonghuming=&#8217;&quot;&amp;d&amp;&quot;&#8217;,mima=&#8217;&quot;&amp;e&amp;&quot;&#8217; where id=&quot;&amp;a     <br />response.write sqlstr     <br />conn.execute sqlstr     <br />response.write&quot;恭喜，数据修改成功!&quot; </p>
<p>删除一条指定表中id字段数值的数据    <br />dim a     <br />a=request(&quot;delid&quot;)     <br />sqlstr=&quot;delete from huiyuanbiao where id=&quot;&amp;a     <br />conn.execute sqlstr     <br />response.write&quot;恭喜，删除成功!&quot; </p>
<p>7、用Recordset对象和asp操作数据库的常用写法    <br />(1)用sql语句，取出news表中所有的数据放到rs中,按照数据库默认排序     <br />Set Rs=Server.CreateObject(&quot;ADODB.RecordSet&quot;)     <br />SqlStr=&quot;select * from news&quot;     <br />Rs.Open SqlStr,conn,1,1 </p>
<p>(2)取出news表中前6条数据放到rs中，按照数据库默认排序方式    <br />Set Rs=Server.CreateObject(&quot;ADODB.RecordSet&quot;)     <br />SqlStr=&quot;select top 6 * from news&quot;     <br />Rs.Open SqlStr,conn,1,1 </p>
<p>(3)循环显示6条rs对象中存在的数据，列表显示 </p>
<p>不带连接的写法    <br />for n=1 to 6     <br />&#160;&#160; response.write&#160;&#160; rs(&quot;title&quot;)&amp;&quot;&lt;br&gt;&quot;     <br />&#160;&#160; if&#160;&#160; rs.eof then     <br />&#160;&#160;&#160;&#160;&#160; exit for     <br />&#160;&#160; else     <br />&#160;&#160;&#160;&#160;&#160; rs.movenext     <br />&#160;&#160; end if     <br />next </p>
<p>带连接的写法    <br />for n=1 to 6     <br />&#160;&#160;&#160;&#160;&#160;&#160; response.write &quot;&lt;a href=show.asp?id=rs(&quot;id&quot;)&gt;&quot;&amp; left(rs(&quot;title&quot;),20)&amp;&quot;&lt;/a&gt;&lt;br&gt;&quot;     <br />&#160;&#160;&#160;&#160;&#160;&#160; if&#160;&#160; rs.eof then     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; exit for     <br />&#160;&#160;&#160;&#160;&#160;&#160; else     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; rs.movenext     <br />&#160;&#160;&#160;&#160;&#160;&#160; end if     <br />next </p>
<p>(4)向数据库添加一条数据代码    <br />Set Rs=Server.CreateObject(&quot;ADODB.RecordSet&quot;)     <br />SqlStr=&quot;select * from news&quot;     <br />Rs.Open SqlStr,conn,1,3&#8242;注意这里的1,3代表可以写入的打开数据表     <br />Rs.addnew     <br />Rs(&quot;title&quot;)=trim(request.form(&quot;title&quot;))     <br />Rs(&quot;neirong&quot;)=request.form(&quot;neirong&quot;)     <br />Rs(&quot;date&quot;)=now()     <br />rs.update&#160;&#160;&#160;&#160;&#160;&#160; &#8216;真正写入数据库 </p>
<p>(5)修改一条记录的代码,通过(2)中的连接传递过来了id数值    <br />Set Rs=Server.CreateObject(&quot;ADODB.RecordSet&quot;)     <br />SqlStr=&quot;select * from news where id=&quot;&amp;request(&quot;id&quot;)     <br />Rs.Open SqlStr,conn,1,3 &#8216;注意这里的1,3代表可以写入的打开数据表     <br />Rs(&quot;title&quot;)=trim(request(&quot;title&quot;))     <br />Rs(&quot;neirong&quot;)=request(&quot;neirong&quot;)     <br />Rs(&quot;date&quot;)=now()     <br />rs.update&#160;&#160;&#160;&#160;&#160;&#160; &#8216;真正写入数据库 </p>
<p>(6)删除数据库中一条记录，通过连接传递过来了数据得id数值    <br />Set Rs=Server.CreateObject(&quot;ADODB.RecordSet&quot;)     <br />SqlStr=&quot;select * from news where id=&quot;&amp;request(&quot;id&quot;)     <br />Rs.Open SqlStr,conn,1,3 &#8216;注意这里的1,3代表可以写入的打开数据表     <br />rs.delete&#160;&#160; &#8216;删除该条数据 </p>
<p>8、当点击按钮时候表单带着的数据传送到哪个文件,在哪里指定? </p>
<p>&lt;form&#160;&#160; method=&quot;post&quot; action=&quot;addsave.asp&quot;&gt;    <br />&#160;&#160; &lt;input type=&quot;text&quot; name=&quot;a&quot;&gt;     <br />&#160;&#160; &lt;input type=&quot;text&quot; name=&quot;b&quot;&gt;     <br />&#160;&#160; &lt;input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;提交&quot;&gt;     <br />&lt;/form&gt; </p>
<p>9、表单提交来的数据接收并显示到屏幕上的代码    <br />response.write request.form(&quot;a&quot;)     <br />response.write now()     <br />response.write trim(request.form(&quot;b&quot;))</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhukun.net/archives/2707/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>C#中如何在软件界面上显示时间？</title>
		<link>http://www.zhukun.net/archives/2923</link>
		<comments>http://www.zhukun.net/archives/2923#comments</comments>
		<pubDate>Mon, 12 Oct 2009 12:29:21 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[学习]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://www.zhukun.net/?p=2923</guid>
		<description><![CDATA[在用C#设计软件的时候，会经常在软件界面上显示一个系统时间，本文将一步一步告诉你如何实现它。其实很简单，一般的程序员都会，但本人是菜鸟中有菜鸟，仍需要靠本文来记录一下。 假设已经有一个label（保持其Name属性为默认的label1不变），我们要把该label显示为系统时间。 在工具箱的“组件”分类下找到Timer控件，双击之，新建一个Timer控件。由于Timer控件是不可见的，因此将出现在设计器底部。保持其Name属性为默认的timer1，将Enable属性设置为True，将Interval属性（该属性决定了每隔多长时间触发其Tick事件）设置为1000。 双击该Timer控件，进入代码编辑器编辑其Tick事件。可用的代码如下 显示日期：label1.Text = &#34;当前时间:&#34; + DateTime.Now.ToLongDateString(); 显示时间：label1.Text = &#34;当前时间:&#34; + DateTime.Now.ToLongTimeString(); 二者都显示：label1.Text = &#34;当前时间:&#34; + DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString(); 至此，按F5运行一下程序，就会发现软件上已显示出来系统时间了。]]></description>
			<content:encoded><![CDATA[<p>在用C#设计软件的时候，会经常在软件界面上显示一个系统时间，本文将一步一步告诉你如何实现它。其实很简单，一般的程序员都会，但本人是菜鸟中有菜鸟，仍需要靠本文来记录一下。</p>
<p>假设已经有一个label（保持其Name属性为默认的label1不变），我们要把该label显示为系统时间。</p>
<p>在工具箱的“组件”分类下找到Timer控件，双击之，新建一个Timer控件。由于Timer控件是不可见的，因此将出现在设计器底部。保持其Name属性为默认的timer1，将Enable属性设置为True，将Interval属性（该属性决定了每隔多长时间触发其Tick事件）设置为1000。</p>
<p>双击该Timer控件，进入代码编辑器编辑其Tick事件。可用的代码如下</p>
<p><span id="more-2923"></span></p>
<p>显示日期：label1.Text = &quot;当前时间:&quot; + DateTime.Now.ToLongDateString();</p>
<p>显示时间：label1.Text = &quot;当前时间:&quot; + DateTime.Now.ToLongTimeString();</p>
<p>二者都显示：label1.Text = &quot;当前时间:&quot; + DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString();</p>
<p>至此，按F5运行一下程序，就会发现软件上已显示出来系统时间了。</p>
<p><a href="http://farm4.static.flickr.com/3522/3995514934_2091658cd9_o.jpg" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" border="0" src="http://farm4.static.flickr.com/3522/3995514934_2091658cd9_o.jpg" /></a></p>
<p><a href="http://farm4.static.flickr.com/3460/3995514718_2dd6b5518a_o.jpg" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" border="0" src="http://farm4.static.flickr.com/3460/3995514718_2dd6b5518a_o.jpg" width="500" height="183" /></a></p>
<p><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" border="0" src="http://farm3.static.flickr.com/2528/3995514788_1a14abc468_o.jpg" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhukun.net/archives/2923/feed</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>SQL Server与SQL Server Compact的关系</title>
		<link>http://www.zhukun.net/archives/2372</link>
		<comments>http://www.zhukun.net/archives/2372#comments</comments>
		<pubDate>Fri, 09 Oct 2009 08:51:16 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[数据库]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://www.zhukun.net/?p=2372</guid>
		<description><![CDATA[SQL Server Compact是面向移动和嵌入式设备的关系数据库，由于其运行环境的特殊性，数据库性能调校和程序优化显得更加重要，该数据库的后缀名为.sdf。一般用于手持设备比如PDA等。 SQL Server是基于关系型数据库的大型数据库系统，该数据库的后缀名为.mdf，数据库日志文件的后缀名为.ldf。 compact ['kɔmpækt] 合同， 协定]]></description>
			<content:encoded><![CDATA[<p>SQL Server Compact是面向移动和嵌入式设备的关系数据库，由于其运行环境的特殊性，数据库性能调校和程序优化显得更加重要，该数据库的后缀名为.sdf。一般用于手持设备比如PDA等。</p>
<p>SQL Server是基于关系型数据库的大型数据库系统，该数据库的后缀名为.mdf，数据库日志文件的后缀名为.ldf。</p>
<p>compact<br />
['kɔmpækt]<br />
合同， 协定</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhukun.net/archives/2372/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>最近的C#学习</title>
		<link>http://www.zhukun.net/archives/1840</link>
		<comments>http://www.zhukun.net/archives/1840#comments</comments>
		<pubDate>Mon, 01 Jun 2009 13:56:15 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[大学]]></category>
		<category><![CDATA[学习]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://www.zhukun.net/?p=1840</guid>
		<description><![CDATA[学习C#也有一段时间了，今天来写写它的感受吧。这是我第一个能深入地去学习的编程语言，以前学Java的时候，虽然也编写过记事本、手机归属地查询之类的小东西，但是我感觉一直不够深入，从没有过像今天这样去深入的了解C#。 因为JAVA和C#有90的相似度，所以看C#基础知识简直如行云流水一般，不到二周时间，看完了这本整整554页的《C#2.0完全自学手册》。以为自己了解了所有C#的基础知识，于是上网买来一本用C#做项目的实例教程看，结果刚看到第一个项目的时候就傻眼了，那是一个“企业客户管理系统”，设计数据库，画E-R图，再写公共类，我晕晕，总算看到代码设计那一页了，结果整整花了一整天时间，才只搞懂人家的登陆窗口代码……（狂汗！！！）。 关于varchar数据类型 C#中是没有数据varchar这种数据类型的，这是SQL Server数据库中的一种数据类型，所以你可能会在C#相关书中见到它，请不要奇怪。 char：固定长度的非 Unicode 字符数据，最大长度为8000个字符。 varchar：可变长度的非 Unicode 数据，最长为8000个字符。 nchar：是固定长度的 Unicode 字符串类型，最大长度为4000个字符。 关于C#中的decimal数据类型 decimal 关键字表示128位数据类型。同浮点型相比，decimal 类型具有更高的精度和更小的范围，这使它适合于财务和货币计算。 如果希望实数被视为 decimal 类型，请使用后缀 m 或 M ，例如： decimal myMoney = 300.5m; 如果没有后缀 m，数字将被视为 double 类型，从而导致编译器错误。 整型被隐式转换为 decimal，其计算结果为 decimal。因此，可以用整数初始化十进制变量而不使用后缀，比如： decimal myMoney = 300; &#8230; <a href="http://www.zhukun.net/archives/1840">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>学习C#也有一段时间了，今天来写写它的感受吧。这是我第一个能深入地去学习的编程语言，以前学Java的时候，虽然也编写过记事本、手机归属地查询之类的小东西，但是我感觉一直不够深入，从没有过像今天这样去深入的了解C#。</p>
<p>因为JAVA和C#有90的相似度，所以看C#基础知识简直如行云流水一般，不到二周时间，看完了这本整整554页的《C#2.0完全自学手册》。以为自己了解了所有C#的基础知识，于是上网买来一本用C#做项目的实例教程看，结果刚看到第一个项目的时候就傻眼了，那是一个“企业客户管理系统”，设计数据库，画E-R图，再写公共类，我晕晕，总算看到代码设计那一页了，结果整整花了一整天时间，才只搞懂人家的登陆窗口代码……（狂汗！！！）。<span id="more-1840"></span></p>
<p><strong>关于varchar数据类型</strong><br />
C#中是没有数据varchar这种数据类型的，这是SQL Server数据库中的一种数据类型，所以你可能会在C#相关书中见到它，请不要奇怪。<br />
char：固定长度的非 Unicode 字符数据，最大长度为8000个字符。<br />
varchar：可变长度的非 Unicode 数据，最长为8000个字符。<br />
nchar：是固定长度的 Unicode 字符串类型，最大长度为4000个字符。</p>
<p><strong>关于C#中的decimal数据类型</strong><br />
decimal 关键字表示128位数据类型。同浮点型相比，decimal 类型具有更高的精度和更小的范围，这使它适合于财务和货币计算。</p>
<p>如果希望实数被视为 decimal 类型，请使用后缀 m 或 M ，例如：<br />
decimal myMoney = 300.5m;<br />
如果没有后缀 m，数字将被视为 double 类型，从而导致编译器错误。</p>
<p>整型被隐式转换为 decimal，其计算结果为 decimal。因此，可以用整数初始化十进制变量而不使用后缀，比如：<br />
decimal myMoney = 300;</p>
<p>在 double(浮点型) 和 decimal 类型之间不存在隐式转换；因此，必须使用强制转换在这两种类型之间进行转换。例如：<br />
decimal myMoney = 99.9m;<br />
double x = (double)myMoney;<br />
myMoney = (decimal)x;</p>
<p><strong>关于override修饰符与重载的区别</strong><br />
override修饰符，覆写一个基类中的方法。重载则是将将同名方法重新写过，达到同名的函数实现不同的功能。从而实现了一个方法有不同的版本。override与重载的本质区别是，加入了override的修饰符的方法，此方法始终只有一个被你使用的方法。<br />
override就好像“你叫张三，你爸爸给你修改了名字为李四”；重载就好像“你叫张三，但是别人也可以叫张三”。</p>
<p>MSDN给的解释是“要扩展或修改继承的方法、属性、索引器或事件的抽象实现或虚实现，必须使用 override 修饰符”。</p>
<p><strong>HasRows属性</strong><br />
获取一个值，用于指示相应的 DataReader 中是否包含一行或多行。如果包含有一行或者多行，则返回true，否则返回false。<br />
在C#中的用法：<br />
public bool HasRows {get;} </p>
<p><strong>关于Dataset对象</strong><br />
DataSet是可以把数据读出来，加载到内存中，然后在本机进行数据操作，比如insert、updata、delete等,   然后一并提交给数据库。</p>
<p>微软的解释：“从 System.Data 名称空间使用多种对象，您可以连接到一个数据库服务器，运行查询，然后把结果放到 DataSet 对象中。DataSet 是断开连接的对象。因此，加载数据后，在您想加载更多数据或想使用您对这些信息的内存中副本所作的更改更新服务器之前，不会再使用与数据库的连接。”</p>
<p><strong>关于DataAdapter</strong><br />
DataAdapter 的Update 方法可调用来将DataSet 中的更改解析回数据源。<br />
SqlDataAdapter 是 DataSet 和 SQL Server 之间的桥接器，用于检索和保存数据。SqlDataAdapter 通过对数据源使用适当的 Transact-SQL 语句映射 Fill（它可更改 DataSet 中的数据以匹配数据源中的数据）和 Update（它可更改数据源中的数据以匹配 DataSet 中的数据）来提供这一桥接。更新是逐行进行的。对于每个已插入、修改和删除的行，Update 方法会确定已对其执行的更改的类型（Insert、Update 或 Delete）。根据更改类型，执行 Insert、Update 或 Delete 命令模板将已修改的行传播给数据源。当 SqlDataAdapter 填充 DataSet 时，它为返回的数据创建必需的表和列（如果这些表和列尚不存在）。</p>
<p><strong>关于BinaryReader</strong><br />
用特定的编码将基元数据类型读作二进制值。</p>
<p>几个生僻单词：<br />
execute:实行, 实施, 执行，履行，操纵，演奏<br />
adapter:适应者，适配器，衔接器，改编者</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhukun.net/archives/1840/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>C#视频教程下载</title>
		<link>http://www.zhukun.net/archives/1623</link>
		<comments>http://www.zhukun.net/archives/1623#comments</comments>
		<pubDate>Sat, 23 May 2009 15:14:50 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[C#视频教程]]></category>
		<category><![CDATA[下载]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://www.zhukun.net/?p=1623</guid>
		<description><![CDATA[　　初学者在学习程序的过程中很重要的一个学习方法就是读源代码，但如果对语言本身的了解不够，在阅读源码的过程中会遇到很大的困难。磨刀不误砍柴功，制作《C#语言参考视频》教程的目的在于帮助初学者打下坚实的语言基础，降低程序学习的难度。 　　本教程由广西机电职业技术学院的陈广老师录制，供学生课后自学用，教程以手把手的方式，通过简单实例入手，层层深入，对C#语言进行了详细而全面地讲解。 本教程面向的对象为： 1、看过一些初级C#教程，对基本语法，三大结构理解没有困难的人员。 2、学习过其它语言，想转入到C#进行学习的人员。 视频来源：http://www.enet.com.cn/eschool/video/c/ 欢迎访问：http://www.zhukun.net 下载地址： 总共45节课程，即45个文件，需要您一个一个下载。这是微软的SkyDrive网络硬盘，故此地址理论上不会失效。 打包压缩后，有297M的体积，我找了好久，总算找出来一个单个文件支持300M的网络硬盘。下载地址见下。因为网络硬盘每天有下载流量限制，好像是1G吧。如果提示流量超限，请明天再来下载。如果下载地址失效，请联系我：zhukun888@vip.qq.com 打包下载：下载地址一 注意：请先打开这个页面，点击“Download for free with FileFactory Basic”，在页面中输入验证码，然后方可用迅雷下载。]]></description>
			<content:encoded><![CDATA[<div align="center"><img src="/wp-content/uploads/73.jpg" alt="C#视频教程下载" width="550" height="100" border="0" /></div>
<p>　　初学者在学习程序的过程中很重要的一个学习方法就是读源代码，但如果对语言本身的了解不够，在阅读源码的过程中会遇到很大的困难。磨刀不误砍柴功，制作《C#语言参考视频》教程的目的在于帮助初学者打下坚实的语言基础，降低程序学习的难度。</p>
<p>　　本教程由广西机电职业技术学院的陈广老师录制，供学生课后自学用，教程以手把手的方式，通过简单实例入手，层层深入，对C#语言进行了详细而全面地讲解。</p>
<p>本教程面向的对象为：<br />
1、看过一些初级C#教程，对基本语法，三大结构理解没有困难的人员。<br />
2、学习过其它语言，想转入到C#进行学习的人员。<span id="more-1623"></span></p>
<p>视频来源：<a href="http://www.enet.com.cn/eschool/video/c/">http://www.enet.com.cn/eschool/video/c/</a><br />
欢迎访问：<a href="http://www.zhukun.net">http://www.zhukun.net</a></p>
<p>下载地址：<iframe scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:240px;height:26px;margin:3px;padding:0;border:1px solid #dde5e9;background-color:#ffffff;" src="http://cid-0012ccd4a57d4f2e.skydrive.live.com/embedrow.aspx/C%7C3%e7%a8%8b%e5%ba%8f%e8%ae%be%e8%ae%a1%e5%85%a5%e9%97%a8%e4%b8%8e%e5%ae%9e%e4%be%8b%e8%a7%86%e9%a2%91%e6%95%99%e7%a8%8b"></iframe><br />
总共45节课程，即45个文件，需要您一个一个下载。这是微软的SkyDrive网络硬盘，故此地址理论上不会失效。</p>
<p>打包压缩后，有297M的体积，我找了好久，总算找出来一个单个文件支持300M的网络硬盘。下载地址见下。因为网络硬盘每天有下载流量限制，好像是1G吧。如果提示流量超限，请明天再来下载。如果下载地址失效，请联系我：zhukun888@vip.qq.com</p>
<p>打包下载：<a href="http://www.filefactory.com/file/aghaccf/n/C_sharp_learning_rar">下载地址一</a><br />
注意：请先打开这个页面，点击“Download for free with FileFactory Basic”，在页面中输入验证码，然后方可用迅雷下载。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhukun.net/archives/1623/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>找程序员当老公的好处</title>
		<link>http://www.zhukun.net/archives/1511</link>
		<comments>http://www.zhukun.net/archives/1511#comments</comments>
		<pubDate>Mon, 18 May 2009 00:33:55 +0000</pubDate>
		<dc:creator>bear</dc:creator>
				<category><![CDATA[编程学习]]></category>
		<category><![CDATA[搞笑]]></category>
		<category><![CDATA[程序员]]></category>
		<category><![CDATA[笑话]]></category>
		<category><![CDATA[编程]]></category>

		<guid isPermaLink="false">http://www.zhukun.net/?p=1511</guid>
		<description><![CDATA[1，专情，程序员老公懂得依靠一个小小的CPU，就打造出一个精彩奇妙的世界，自然也十分懂得挖掘老婆的精彩。所以，程序员专情指数十分高，过起日子来踏实可靠。 2，有趣，程序员都是最聪明的人，有创意，带到生活中就是情趣，有人以为程序员很死板，其实他们最闷骚。 3，能干，工程师就是工程师，上知天文，下懂修水管,而且思维严密、考虑周全，有执行力。 4，易相处，因为程序员是一种需要极大耐心的工作，所以我有生以来还没见到过一个脾气暴躁的程序员，而且最可爱的是程序员是一种百搭的老公。 5，程序员尽管收入可能不如银行家、医生什么的，可是程序员失业率十分的低，而且不用飞来飞去的出差，也不爱虚荣，挣来的钱基本上都交给了家里，简直是世界上最实惠的老公了。]]></description>
			<content:encoded><![CDATA[<p>    1，专情，程序员老公懂得依靠一个小小的CPU，就打造出一个精彩奇妙的世界，自然也十分懂得挖掘老婆的精彩。所以，程序员专情指数十分高，过起日子来踏实可靠。</p>
<p>    2，有趣，程序员都是最聪明的人，有创意，带到生活中就是情趣，有人以为程序员很死板，其实他们最闷骚。</p>
<p>    3，能干，工程师就是工程师，上知天文，下懂修水管,而且思维严密、考虑周全，有执行力。</p>
<p>    4，易相处，因为程序员是一种需要极大耐心的工作，所以我有生以来还没见到过一个脾气暴躁的程序员，而且最可爱的是程序员是一种百搭的老公。</p>
<p>    5，程序员尽管收入可能不如银行家、医生什么的，可是程序员失业率十分的低，而且不用飞来飞去的出差，也不爱虚荣，挣来的钱基本上都交给了家里，简直是世界上最实惠的老公了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhukun.net/archives/1511/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

