<?xml version="1.0" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="css/rss.xslt"?>
<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>Maple'CR  - VB.NET</title><link>http://www.maple.hk/</link><description>幻梦墟 - </description><generator>RainbowSoft Studio Z-Blog 1.8 Walle Build 100427</generator><language>zh-CN</language><copyright>Copyright 2005-2010 Maple.hk Some Rights Reserved.</copyright><pubDate>Thu, 09 Sep 2010 19:31:06 +0800</pubDate><item><title>一个Asp.net 2.0 Treeview 无限级无刷新示例</title><author>credmaple@msn.com (credmaple)</author><link>http://www.maple.hk/archives/20070207/162/</link><pubDate>Wed, 07 Feb 2007 11:45:28 +0800</pubDate><guid>http://www.maple.hk/archives/20070207/162/</guid><description><![CDATA[<%@ Page Language="C#" %><br/><%@ Import Namespace="System.IO" %><br/><br/><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><br/><br/><script runat="server"><br/><br/>    void Treeview1_TreeNodePopulate(object sender, TreeNodeEventArgs e)<br/>    {<br/>       if (IsCallback)<br/>            if (e.Node.ChildNodes.Count == 0)<br/>            {<br/>                LoadChildNode(e.Node);<br/>            }<br/>       <br/>    }<br/><br/>    private void LoadChildNode(TreeNode node)<br/>    {<br/>        <br/>        DirectoryInfo directory;<br/>        directory = new DirectoryInfo(node.Value);      <br/><br/>        foreach (DirectoryInfo sub in directory.GetDirectories())<br/>        {<br/>         <br/>            TreeNode subNode = new TreeNode(sub.Name);<br/>            subNode.Value = sub.FullName;<br/><br/>            try<br/>            {<br/>                if (sub.GetDirectories().Length > 0 || sub.GetFiles().Length > 0)<br/>                {<br/>                    subNode.SelectAction = TreeNodeSelectAction.SelectExpand;<br/>                    subNode.PopulateOnDemand = true;<br/>                    subNode.NavigateUrl = "#";<br/>                }<br/>           }<br/>            catch { subNode.ImageUrl = "WebResource.axd?a=s&r=TreeView_XP_Explorer_ParentNode.gif&t=632242003305625000"; }<br/>            node.ChildNodes.Add(subNode);<br/>            <br/>        }<br/><br/>        foreach (FileInfo fi in directory.GetFiles())<br/>        {<br/>            TreeNode subNode = new TreeNode(fi.Name);<br/>            node.ChildNodes.Add(subNode);<br/>        }<br/>    }<br/>    <br/>    <br/></script><br/><br/><html xmlns="http://www.w3.org/1999/xhtml" ><br/><head runat="server"><br/>    <title>Untitled Page</title><br/></head><br/><br/><body bgcolor="white"><br/>    <form id="form1" runat="server">    <div>    <asp:treeview ID="Treeview1" runat="server" ImageSet="XPFileExplorer" AutoGenerateDataBindings="false" ExpandDepth=0 <br/>        OnTreeNodePopulate="Treeview1_TreeNodePopulate"<br/>    ><br/>        <SelectedNodeStyle BackColor="#B5B5B5"></SelectedNodeStyle><br/>        <Nodes><br/>            <asp:TreeNode Value="C:" Text="C:" PopulateOnDemand="true" SelectAction="Select" NavigateUrl="#" ><br/>            </asp:TreeNode><br/>        </Nodes><br/>        <NodeStyle VerticalPadding="2" Font-Names="Tahoma" Font-Size="8pt" HorizontalPadding="2"<br/>            ForeColor="Black"></NodeStyle><br/>        <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA"></HoverNodeStyle><br/>    </asp:treeview><br/>    </div>    </form><br/><br/><br/> <br/><br/><br/>Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1490331<br/><br/>]]></description><category>VB.NET</category><comments>http://www.maple.hk/archives/20070207/162/#comment</comments><wfw:comment>http://www.maple.hk/</wfw:comment><wfw:commentRss>http://www.maple.hk/feed.asp?cmt=162</wfw:commentRss><trackback:ping>http://www.maple.hk/cmd.asp?act=tb&amp;id=162&amp;key=7bd4ecde</trackback:ping></item><item><title>Visual C#常用函数和方法集汇总</title><author>credmaple@msn.com (credmaple)</author><link>http://www.maple.hk/archives/20070207/161/</link><pubDate>Wed, 07 Feb 2007 11:44:13 +0800</pubDate><guid>http://www.maple.hk/archives/20070207/161/</guid><description><![CDATA[1、DateTime 数字型 <br/><br/>System.DateTime currentTime=new System.DateTime(); <br/>　　1.1 取当前年月日时分秒 <br/><br/>currentTime=System.DateTime.Now; <br/>　　1.2 取当前年 <br/><br/>int 年=currentTime.Year; <br/>　　1.3 取当前月 <br/><br/>int 月=currentTime.Month; <br/>　　1.4 取当前日 <br/><br/>int 日=currentTime.Day; <br/>　　1.5 取当前时 <br/><br/>int 时=currentTime.Hour; <br/>　　1.6 取当前分 <br/><br/>int 分=currentTime.Minute; <br/>　　1.7 取当前秒 <br/><br/>int 秒=currentTime.Second; <br/>　　1.8 取当前毫秒 <br/><br/>int 毫秒=currentTime.Millisecond; <br/>（变量可用中文） <br/>　　1.9 取中文日期显示——年月日时分 <br/><br/>string strY=currentTime.ToString("f"); //不显示秒 <br/>　　1.10 取中文日期显示_年月 <br/><br/>string strYM=currentTime.ToString("y"); <br/>　　1.11 取中文日期显示_月日 <br/><br/>string strMD=currentTime.ToString("m"); <br/>　　1.12 取当前年月日，格式为：2003-9-23 <br/><br/>string strYMD=currentTime.ToString("d"); <br/>　　1.13 取当前时分，格式为：14：24 <br/><br/>string strT=currentTime.ToString("t"); <br/>　　2、字符型转换 转为32位数字型 <br/><br/>　　Int32.Parse(变量) Int32.Parse("常量") <br/><br/>　　3、 变量.ToString() <br/><br/>　　字符型转换 转为字符串 <br/>　　12345.ToString("n"); //生成 12,345.00 <br/>　　12345.ToString("C"); //生成 ￥12,345.00 <br/>　　12345.ToString("e"); //生成 1.234500e+004 <br/>　　12345.ToString("f4"); //生成 12345.0000 <br/>　　12345.ToString("x"); //生成 3039 (16进制) <br/>　　12345.ToString("p"); //生成 1,234,500.00% <br/><br/>　　4、变量.Length 数字型 <br/><br/>　　取字串长度： <br/><br/>　　如： string str="中国"; <br/><br/>int Len = str.Length ; //Len是自定义变量， str是求测的字串的变量名 <br/>　　5、字码转换 转为比特码 <br/><br/>　　System.Text.Encoding.Default.GetBytes(变量) <br/><br/>　　如：byte[] bytStr = System.Text.Encoding.Default.GetBytes(str); <br/><br/>　　然后可得到比特长度： <br/><br/>　　len = bytStr.Length; <br/><br/>　　6、System.Text.StringBuilder("") <br/><br/>　　字符串相加，（+号是不是也一样？） <br/><br/>　　如： <br/><br/>System.Text.StringBuilder sb = new System.Text.StringBuilder(""); <br/>sb.Append("中华"); <br/>sb.Append("人民"); <br/>sb.Append("共和国"); <br/>　　7、变量.Substring(参数1,参数2); <br/><br/>　　截取字串的一部分，参数1为左起始位数，参数2为截取几位。 <br/><br/>　　如：string s1 = str.Substring(0,2); <br/><br/>　　8、取远程用户IP地址 <br/><br/>String user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString(); <br/>　　9、穿过代理服务器取远程用户真实IP地址： <br/><br/>if(Request.ServerVariables["HTTP_VIA"]!=null){ <br/>string user_IP=Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString(); <br/>}else{ <br/>string user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString(); <br/>} <br/>　　10、存取Session值 <br/><br/>Session["变量"]; <br/>　　如，赋值： <br/><br/>Session["username"]="小布什"; <br/>　　取值： <br/><br/>Object objName=Session["username"]; <br/>String strName=objName.ToString(); <br/>　　清空： <br/><br/>Session.RemoveAll(); <br/>　　11、用超链接传送变量 <br/><br/>String str=Request.QueryString["变量"]; <br/>　　如在任一页中建超链接:＜a href=Edit.aspx?fbid=23＞点击＜/a＞ <br/><br/>　　在Edit.aspx页中取值：String str=Request.QueryString["fdid"]; <br/><br/>　　12、创建XML文档新节点 <br/><br/>　　DOC对象.CreateElement("新建节点名"); <br/><br/>　　13、将新建的子节点加到XML文档父节点下 <br/><br/>　　父节点.AppendChild(子节点)； <br/><br/>　　14、 删除节点 <br/><br/>　　父节点.RemoveChild(节点); <br/><br/>　　15、向页面输出：Response <br/><br/>Response.Write("字串")； <br/>Response.Write(变量)； <br/>　　跳转到URL指定的页面： <br/><br/>Response.Redirect("URL地址"）； <br/>　　16、查指定位置是否空字符 <br/><br/>char.IsWhiteSpce(字串变量，位数)——逻辑型； 　　 <br/>　　如： <br/><br/>string str="中国 人民"; <br/>Response.Write(char.IsWhiteSpace(str,2)); //结果为：True, 第一个字符是0位，2是第三个字符。 <br/>　　17、查字符是否是标点符号 <br/><br/>char.IsPunctuation(''字符'') --逻辑型 <br/>　　如： <br/><br/>Response.Write(char.IsPunctuation(''A'')); //返回：False <br/>　　18、把字符转为数字，查代码点，注意是单引号。 <br/><br/>　　(int)''字符'' <br/><br/>　　如： <br/><br/>Response.Write((int)''中''); //结果为中字的代码：20013 <br/>　　19、把数字转为字符，查代码代表的字符：(char)代码 <br/><br/>　　如： <br/><br/>Response.Write((char)22269); //返回“国”字。 <br/>　　20、 清除字串前后空格: Trim() <br/><br/>　　21、字串替换 <br/><br/>　　字串变量.Replace("子字串","替换为") <br/><br/>　　如： <br/><br/>string str="中国"; <br/>str=str.Replace("国","央"); //将国字换为央字 <br/>Response.Write(str); //输出结果为“中央” <br/>　　再如：（这个非常实用） <br/><br/>string str="这是＜script＞脚本"; <br/>str=str.Replace("＜","＜font＞＜＜/font＞"); //将左尖括号替换为＜font＞ 与 ＜ 与 ＜/font＞ （或换为＜，但估计经XML存诸后，再提出仍会还原） <br/>Response.Write(str); //显示为：“这是＜script＞脚本” <br/>　　如果不替换，＜script＞将不显示，如果是一段脚本，将运行；而替换后，脚本将不运行。 <br/><br/>　　这段代码的价值在于：你可以让一个文本中的所有HTML标签失效，全部显示出来，保护你的具有交互性的站点。 <br/><br/>　　具体实现：将你的表单提交按钮脚本加上下面代码： <br/><br/>string strSubmit=label1.Text; //label1是你让用户提交数据的控件ID。 <br/>strSubmit=strSubmit.Replace("＜","＜font＞＜＜/font＞"); <br/>　　然后保存或输出strSubmit。 <br/><br/>　　用此方法还可以简单实现UBB代码。 <br/><br/>　　22、取i与j中的最大值：Math.Max(i,j) <br/><br/>　　如 int x=Math.Max(5,10); // x将取值 10 <br/><br/>　　加一点吧 23、字串对比...... <br/><br/>　　23、字串对比一般都用: if(str1==str2){ } , 但还有别的方法: <br/><br/>　　(1)、 <br/><br/>string str1; str2 <br/>//语法: str1.EndsWith(str2); __检测字串str1是否以字串str2结尾,返回布尔值.如: <br/>if(str1.EndsWith(str2)){ Response.Write("字串str1是以"+str2+"结束的"); } <br/>　　(2)、 <br/><br/>//语法:str1.Equals(str2); __检测字串str1是否与字串str2相等,返回布尔值,用法同上. <br/>　　(3)、 <br/><br/>//语法 Equals(str1,str2); __检测字串str1是否与字串str2相等,返回布尔值,用法同上. <br/>　　24、查找字串中指定字符或字串首次（最后一次）出现的位置,返回索引值：IndexOf() 、LastIndexOf()， 如： <br/><br/>str1.IndexOf("字")； //查找“字”在str1中的索引值（位置） <br/>str1.IndexOf("字串")；//查找“字串”的第一个字符在str1中的索引值（位置） <br/>str1.IndexOf("字串",3,2)；//从str1第4个字符起，查找2个字符，查找“字串”的第一个字符在str1中的索引值（位置） <br/>　　25、在字串中指定索引位插入指定字符：Insert() ，如： <br/><br/>str1.Insert(1,"字");在str1的第二个字符处插入“字”，如果str1="中国"，插入后为“中字国”； <br/>　　26、在字串左（或右）加空格或指定char字符，使字串达到指定长度：PadLeft()、PadRight() ，如： <br/><br/>＜% <br/>string str1="中国人"; <br/>str1=str1.PadLeft(10,''1''); //无第二参数为加空格 <br/>Response.Write(str1); //结果为“1111111中国人” ， 字串长为10 <br/>%＞ <br/>　　27、从指定位置开始删除指定数的字符：Remove() <br/><br/>　　28.反转整个一维Array中元素的顺序。 <br/><br/>har[] charArray = "abcde".ToCharArray(); <br/>Array.Reverse(charArray); <br/>Console.WriteLine(new string(charArray)); <br/>　　29.判断一个字符串中的第n个字符是否是大写 <br/><br/>string str="abcEEDddd"; <br/>Response.Write(Char.IsUpper(str,3));<br/><br/><a href="http://www.chinacs.net/archives/1/2006/3515.html"  target="_blank">http://www.chinacs.net/archives/1/2006/3515.html</a><br/>]]></description><category>VB.NET</category><comments>http://www.maple.hk/archives/20070207/161/#comment</comments><wfw:comment>http://www.maple.hk/</wfw:comment><wfw:commentRss>http://www.maple.hk/feed.asp?cmt=161</wfw:commentRss><trackback:ping>http://www.maple.hk/cmd.asp?act=tb&amp;id=161&amp;key=20ae79c4</trackback:ping></item><item><title>一个简单完整的.net使用OleDbDataReader读出数据的例子</title><author>credmaple@msn.com (credmaple)</author><link>http://www.maple.hk/archives/20070112/158/</link><pubDate>Fri, 12 Jan 2007 16:52:44 +0800</pubDate><guid>http://www.maple.hk/archives/20070112/158/</guid><description><![CDATA[If Not IsPostBack Then<br/>            Dim conn As OleDbConnection<br/>            Dim objcommand As OleDbCommand<br/>            Dim strconn As String<br/>            Dim tdr As OleDbDataReader<br/>            strconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database/northwind.mdb")<br/>            conn = New OleDbConnection(strconn)<br/>            conn.Open()<br/>            objcommand = New OleDbCommand("sel&#101;ct * from 产品", conn)<br/>            tdr = objcommand.ExecuteReader()<br/><br/>            Dim i As Integer = 0<br/>            While tdr.Read()<br/><br/>                Label1.Text &= "产品名称：" & tdr("产品名称").ToString & "<br/>"<br/>                i = i = 1<br/>            End While<br/><br/><br/>        End If]]></description><category>VB.NET</category><comments>http://www.maple.hk/archives/20070112/158/#comment</comments><wfw:comment>http://www.maple.hk/</wfw:comment><wfw:commentRss>http://www.maple.hk/feed.asp?cmt=158</wfw:commentRss><trackback:ping>http://www.maple.hk/cmd.asp?act=tb&amp;id=158&amp;key=3d252f69</trackback:ping></item><item><title>在使用ASP.NET时进行页面重定向的3种方法</title><author>credmaple@msn.com (credmaple)</author><link>http://www.maple.hk/archives/20070105/157/</link><pubDate>Fri, 05 Jan 2007 12:50:15 +0800</pubDate><guid>http://www.maple.hk/archives/20070105/157/</guid><description><![CDATA[首先 Response.Redirect("a.aspx")，在保存此页的数据后,服务器将页面直接转向到a.aspx。 此方法有个缺陷，就是转向后会丢失此页所有的Request的参数，并且此方法是需要Client发起一个请求。<br/><br/>      在IIS 5.0 中引入了一个新的函数 Server.Transfer("a.aspx")，它很好地解决了转向后丢失此页Request参数的问题。并且由于它是从server端直接向下一页发起请求，所以不需要client再次发送请求。它与Response.Redirect的区别在于：Response.Redirect可以转向任何一个页面，而Server.Transfer只能转向同目录或子目录的网页；Response.Redirect转向时地址会变成跳转后的页面地址，而Server.Transfer转向时原地址不变，并且传递的参数值也被隐藏。<br/><br/>      另一个方法是Server.Execute(a.aspx)，它和Server.Transfer功能类似。主要的区别在于，server.execute在转向a.aspx执行完成后，还会返回原来的页面继续处理。<br/>]]></description><category>VB.NET</category><comments>http://www.maple.hk/archives/20070105/157/#comment</comments><wfw:comment>http://www.maple.hk/</wfw:comment><wfw:commentRss>http://www.maple.hk/feed.asp?cmt=157</wfw:commentRss><trackback:ping>http://www.maple.hk/cmd.asp?act=tb&amp;id=157&amp;key=02919af2</trackback:ping></item><item><title>有一个关于DataReader对象的说明不错</title><author>credmaple@msn.com (credmaple)</author><link>http://www.maple.hk/archives/20060420/93/</link><pubDate>Thu, 20 Apr 2006 13:32:21 +0800</pubDate><guid>http://www.maple.hk/archives/20060420/93/</guid><description><![CDATA[1． 创建DataReader对象<br/><br/>前面提到过没有构造函数创建DataReader对象。通常我们使用Command类的ExecuteRader方法来创建DataReader对象：<br/><br/>SqlCommand cmd = new SqlCommand(commandText,ConnectionObject)<br/><br/>SqlDataReader dr = cmd.ExecuteReader();<br/><br/>         DataReader类最常见的用法就是检索Sql查询或者存储过程返回的记录。它是连接的只向前和只读的结果集，也就是使用它时，数据库连接必须保持打开状态，另外只能从前往后遍历信息，不能中途停下修改数据。<br/><br/>         注意：DataReader使用底层的连接，连接是它专有的，这意味这DataReader打开时不能使用对应连接进行去他操作，比如执行另外的命令等。使用完DataReader后一定记得关闭阅读器和连接。<br/><br/>       2． 使用命令行为指定DataReader的特征<br/><br/>       前面我们使用cmd.ExecuteReader()实例化DataReader对象，其实这个方法有重载版本,接受命令行参数，这些参数应该时Commandbehavior枚举：<br/><br/>       SqlDataRader dr ＝ cmd.ExecuteReader(CommandBehavior.CloseConnection);<br/><br/>上面我们使用的是CommandBehavior.CloseConnection，作用是关闭DataReader的时候自动关闭对应的ConnectionObject。这样可以避免我们忘记关闭DataReader对象以后关闭Connection对象。别告诉我你不喜欢这个参数，你能保证你记得关闭连接。万一你忘记了呢？又或者你使用你的partner开发的组件来进行开发呢？这个组件并不一定让你有关闭连接的权限哦。另外CommandBehavior.SingleRow可以使结果集返回单个行，CommandBehavior.SingleResult返回结果为多个结果集的第一个结果集。当然Commandbehavior枚举还有其他值，请参见msdn。<br/><br/>       3． 遍历DataReader中的记录<br/><br/>       当ExecuteReader方法分会DataReader对象时，当前光标的位置时第一条记录的前面。必须调用数据阅读器的Read方法把光标移动到第一条记录，然后第一条记录就是当前记录。如果阅读器包含的记录不止一条，Read方法返回一个bool值true。也就是说Read方法的作用是在允许范围内移动光标位置到下一记录，有点类似rs.movenext，不是吗？如果当前光标指示着最后一条记录，此时调用Read方法得到false。我们经常这样做：<br/><br/>While(dr.Reader())<br/><br/>{<br/><br/>//do something with the current record<br/><br/>}<br/><br/>注意，如果你对每一条记录的操作可能花费比较长的时间，那么意味着阅读器将长时间打开，那么数据库连接也将维持长时间的打开状态。此时使用非连接的DataSet或许更好一些。<br/><br/>       4． 访问字段的值<br/><br/>       有2种方法。第一种是Item属性，此属性返回字段索引或者字段名字对应的字段的值。第二种是Get方法，此方法返回有字段索引指定的字段的值。有点难以理解，不是吗？不要紧，看例子就OK了。<br/><br/>       Item属性<br/><br/>       每个DataReader类都定义一个Item属性。比如现在我们有一个DataReader实例dr，对应的sql语句是sel&#101;ct Fid,Fname from friend，则我们可以使用下面的方法取得返回的值：<br/><br/>         object ID = dr[“Fid”];<br/><br/>object Name = dr[“Fname”];<br/><br/>或者：<br/><br/>       object ID = dr[0];<br/><br/>object Name = dr[0];<br/><br/>注意索引总是从0开始的。另外也许您发现了我们使用的是object来定义对ID和Name，是的，Item属性返回的值是object型，但是您可以强制类型转换。<br/><br/>       int ID = (int)dr[“Fid”];<br/><br/>string Name = (string)dr[“Fname”];<br/><br/>记住：确保类型转换的有效性是您自己的责任，否则您将得到异常。<br/><br/>       Get方法<br/><br/>       起始我们在第一篇文章里面已经使用过改方法了。每个DataReader都定义了一组Get方法，比如GetInt32方法把返回的字段值作为.net clr 32位证书。同上面的例子一样我们用如下方式访问Fid和Fname的值：<br/><br/>int ID = dr.GetInt32(0);<br/><br/>string Name = dr.GetString(1);<br/><br/>注意虽然这些方法把数据从数据源类型转化为.net数据类型，但是他们不执行其他的数据转换，比如他们不会把16位整数转换为32位的。所以您必须使用正确的Get方法。另外Get方法不能使用字段名来访问字段，也就是说上面的没有：<br/><br/>int ID = dr.GetInt32(“Fid”);                             //错误<br/><br/>string Name = dr.GetString(“Fname”);              //错误<br/><br/>显然上面这个缺点在某些场合是致命的，当你的字段很多的时候，或者说你过了一段时间以后再来看你这些代码，你会觉得很难以理解！当然我们可以使用其他方法来尽量解决这个问题。一个可行的办法是使用const：<br/><br/>const int FidIndex ＝ 0；<br/><br/>const int NameIndex ＝ 1；<br/><br/>int ID = dr.GetInt32(FidIndex);<br/><br/>string Name = dr.GetString(NameIndex);<br/><br/>这个办法并不怎么好，另外一个好一些的办法：<br/><br/>int NameIndex = dr.GetOrdinal(“Fname”);       //取得Fname对应的索引值<br/><br/>string Name = dr.GetString(NameIndex);<br/><br/>这样似乎有点麻烦，但是当须要遍历阅读器种大量的结果集的时候，这个方法很有效，因为索引只需执行一次。<br/><br/>int FidIndex ＝ dr.GetOrdinal(“Fid”);<br/><br/>int NameIndex = dr.GetOrdinal(“Fname”);<br/><br/>while(dr.Read())<br/><br/>{<br/><br/>         int ID = dr.GetInt32(FidIndex);<br/><br/>         string Name = dr.GetInt32(NameIndex);<br/><br/>}<br/><br/> <br/><br/>到目前为止，我们已经讨论了DataReader的基本操作了。至于DataReader的有些高级超作我们以后再讨论。<br/><br/>下次我们构建一个项目——个人通讯录（单用户版本）。在这个项目中我们将用到前面讨论的所有知识，同时在这个项目里面我将尽量是这个项目符合多层体系结构标准。<br/>]]></description><category>VB.NET</category><comments>http://www.maple.hk/archives/20060420/93/#comment</comments><wfw:comment>http://www.maple.hk/</wfw:comment><wfw:commentRss>http://www.maple.hk/feed.asp?cmt=93</wfw:commentRss><trackback:ping>http://www.maple.hk/cmd.asp?act=tb&amp;id=93&amp;key=76c2120c</trackback:ping></item><item><title>asp.net(vb)学习笔记4</title><author>credmaple@msn.com (credmaple)</author><link>http://www.maple.hk/archives/20060316/85/</link><pubDate>Thu, 16 Mar 2006 17:16:43 +0800</pubDate><guid>http://www.maple.hk/archives/20060316/85/</guid><description><![CDATA[今天真是好哇！阳光明媚、春和日丽、风情万种... ...<br/><br/>今天的事情不是太多，所以抽出了大部分的时候来做.net的测试，当然对于一个初学者来讲测试也就是瞎练练，写些程序员瞧不上眼的过程语句。<br/><br/>嗯，找到asp.net入门精典这本书后真的不错，原先理解不透的东西现在有点思路了，叫法现在也比较标准了，呵呵！原先都是叫一些比较“低级”的词汇，比如子例程、基类什么的。<br/><br/>2005(vb)asp.net的随机函数用法与2003的不同，还好我身边的一个精神病同事帮着指点了一下就顿开毛色了。<br/><br/>关于2005.net我还要讲一句，定义真的是太烦琐了，真要是弄懂了asp.net我感觉也就读懂了.net的涵义，用其它语言也只是语句的问题。<br/><br/>前些天，在经典中发问关于asp.net是否能通过控件来时时接收底下传上来的数据的问题，我恐怕现在已经知道答案了，好象b/s的架构本身就不具备这种功能，唉！<br/><br/>这二点书看的真是有点累，虽说有点asp环境的基础，但.net的复杂程序不是学asp的时候所想象的。<br/><br/>.net中还有一个环节，放弃Response.write改用控件来显示数据源中的数据。代码分离是.net2003就提出来的这样做是为了程序的精简和读懂，但我感觉精简倒是真的，如果要说读懂嘛恐怕就费点劲，毕竟不是自己做出来的程序。<br/><br/>总的说来.net的收益还是有点的，现在我写asp的话恐怕会和.net的语句一起写。呵呵！<br/><br/>以下是2005中随机函数的用法<br/><br/><blockquote><div class="quote">intrnd = Int((35 - 1 + 1) * VBMath.Rnd) + 1<br/><br/>要赋值的变量名=取整(希望随机的最大值 - 希望随机的最小值 + 1) + 1<br/><br/>也不知道我这么翻译能不能读懂，当然那个intrnd要AS啊。呵呵。<br/><br/></div></blockquote><br/><br/>]]></description><category>VB.NET</category><comments>http://www.maple.hk/archives/20060316/85/#comment</comments><wfw:comment>http://www.maple.hk/</wfw:comment><wfw:commentRss>http://www.maple.hk/feed.asp?cmt=85</wfw:commentRss><trackback:ping>http://www.maple.hk/cmd.asp?act=tb&amp;id=85&amp;key=766b303a</trackback:ping></item><item><title>asp.net(vb)学习笔记3</title><author>credmaple@msn.com (credmaple)</author><link>http://www.maple.hk/archives/20060314/84/</link><pubDate>Tue, 14 Mar 2006 10:55:02 +0800</pubDate><guid>http://www.maple.hk/archives/20060314/84/</guid><description><![CDATA[由于工作的原因，所以这二天看的东西很少。<br/><br/>主要是了解了什么是基类，什么是命名空间，也在接触定义类和对象的概念。<br/><br/>关于引用命名空间原来.aspx和.vb引用是不一样的，代码部分竟多出了个Ｓ，弄了半天才明白。<br/><br/>比如在.aspx中引用命名空间格式为：<%@ Import Namespace ="system.data" %><br/>而在vb.net中引用命名空间格式为：Imports System.Data<br/><br/>以下代码是一段打开数据库的代码，用的是ole连接mdb数据库的。<br/><br/>在.vb部分一定要引用命名空间.<br/><br/><blockquote><div class="quote"><br/>Imports System.Data<br/>Imports System.Data.OleDb<br/><br/></div></blockquote><br/><br/><br/><blockquote><div class="quote"><br/>        Dim Conn As OleDbConnection<br/>        Dim adpt As OleDbDataAdapter<br/>        Dim ds As System.Data.DataSet<br/>        Dim provider = "provider=microsoft.jet.oledb.4.0"<br/>        Dim database = "data source=" & Server.MapPath("db1.mdb")<br/>        Conn = New OleDbConnection(provider & ";" & database)<br/>        Conn.Open()<br/>        Dim sql As String = "sel&#101;ct * from baobiao"<br/>        adpt = New OleDbDataAdapter(sql, Conn)<br/>        ds = New DataSet()<br/>        adpt.Fill(ds, "baobiao")<br/>        GridView1.DataSource = ds.Tables("baobiao").DefaultView<br/>        GridView1.DataBind()<br/><br/></div></blockquote>]]></description><category>VB.NET</category><comments>http://www.maple.hk/archives/20060314/84/#comment</comments><wfw:comment>http://www.maple.hk/</wfw:comment><wfw:commentRss>http://www.maple.hk/feed.asp?cmt=84</wfw:commentRss><trackback:ping>http://www.maple.hk/cmd.asp?act=tb&amp;id=84&amp;key=5c8a7c57</trackback:ping></item><item><title>Asp.NET常用函数 (VB.net)</title><author>credmaple@msn.com (credmaple)</author><link>http://www.maple.hk/archives/20060309/80/</link><pubDate>Thu, 09 Mar 2006 13:21:36 +0800</pubDate><guid>http://www.maple.hk/archives/20060309/80/</guid><description><![CDATA[<br/><blockquote><div class="quote"><br/>Ucase(string) 将字符串转换为大写。 <br/>Val(string) 将代表数字的字符串转换为数值型态，若字符串中含有非数字的内容则会将其去除后，合并为一数字。 <br/>Weekday(date) 取的参数中的日期是一个星期的第几天，星期天为1、星期一为2、星期二为3 依此类推。 <br/>WeekDayName(number) 依接收的参数取得星期的名称，可接收的参数为1 到7，星期天为1、星期一为2、星期二为3 依此类推。 <br/>Split(expression[, delimiter]) 以delimiter 参数设定的条件字符串来将字符串分割为字符串数组。 <br/>Sqrt(number) 取得一数值得平方根。 <br/>Str(number) 将数字转为字符串后传回。 <br/>StrReverse(expression) 取得字符串内容反转后的结果。 <br/>Tan(number) 取得某个角度的正切值。 <br/>TimeOfDay() 取得目前不包含日期的时间。 <br/>Timer() 取得由0:00 到目前时间的秒数，型态为Double。 <br/>TimeSerial(hour, minute, second) 将接收的参数合并为一个只有时间Date 型态的数据。 <br/>Timavalue(time) 取得符合国别设定样式的时间值。 <br/>Today() 取得今天不包含时间的日期。 <br/>Trim(string) 去掉字符串开头和结尾的空白。 <br/>TypeName(varname) 取得变量或对象的型态。 <br/>Ubound(arrayname[, dimension]) 取得数组的最终索引值，dimension 参数是指定取得第几维度的最终索引值。 <br/>MonthName(month) 依接收的月份数值取得该月份的完整写法。 <br/>Now() 取得目前的日期和时间。 <br/>Oct(number) 将数值参数转换为8 进制值。 <br/>Replace(expression, find, replace) 将字符串中find 参数指定的字符串转换为replace 参数指定的字符串。 <br/>Right(string,length) 由字符串右边开始取得length 参数设定长度的字符。 <br/>RmDir(path) 移除一个空的目录。 <br/>Rnd() 取得介于0 到1 之间的小数，如果每次都要取得不同的值，使用前需加上Randomize 叙述。 <br/>Rtrim(string) 去掉字符串的右边空白部分。 <br/>Second(time) 取得时间内容的秒部分，型态为Integer。 <br/>Sign(number) 取得数值内容是正数或负数，正数传回1，负数传回-1，0 传回0。 <br/>Sin(number) 取得一个角度的正弦值。 <br/>Space(number) 取得number 参数设定的空白字符串。 <br/>IsDate(expression) 判断表达式内容是否为DateTime 型态，若是则传回True，反之则为False。 <br/>IsDbNull(expression) 判断表达式内容是否为Null，若是则传回True，反之则为False。 <br/>IsNumeric(expression) 判断表达式内容是否为数值型态，若是则传回True，反之则为False。 <br/>Join(sourcearray[, delimiter]) 将字符串数组合并唯一个字符串，delimiter 参数是设定在各个元素间加入新的字符串。 <br/>Lcase(string) 将字符串转换为小写字体。 <br/>Left(string, length) 由字符串左边开始取得length 参数设定长度的字符。 <br/>Len(string) 取得字符串的长度。 <br/>Log(number) 取得数值的自然对数。 <br/>Ltrim(string) 去掉字符串的左边空白部分。 <br/>Mid(string, start[, length]) 取出字符串中strat 参数设定的字符后length 长度的字符串，若length 参数没有设定，则取回start 以后全部的字符。 <br/>Minute(time) 取得时间内容的分部分，型态为Integer。 <br/>MkDir(path) 建立一个新的目录。 <br/>Month(date) 取得日期的月部分，型态为Integer。 <br/>FormatDateTime(date[,namedformat]) 传回格式化的日期或时间数据。 <br/>FormatNumber(expression[,numdigitsafterdecimal [,includeleadingdigit]]) 传回格式化 <br/>的数值数据。Numdigitsafterdecimal 参数为小数字数，includeleadingdigit 参数为当整数为0 时是否补至整数字数。 <br/>FormatPercent(expression[,numdigitsafterdecimal [,includeleadingdigit]]) 传回转换为百分比格式的数值数据。numdigitsafterdecimal 参数为小数字数，includeleadingdigit 参数为当整数为0 时是否补至整数字数。 <br/>GetAttr(filename) 传回档案或目录的属性值。 <br/>Hex(number) 将数值参数转换为16 进制值。 <br/>Hour(time) 传回时间的小时字段，型态是Integer。 <br/>Iif(expression, truepart, falsepart) 当表达式的传回值为True 时执行truepart 字段的程序，反之则执行falsepart 字段。 <br/>InStr([start, ]string1, string2) 搜寻string2 参数设定的字符出现在字符串的第几个字符，start 为由第几个字符开始寻找，string1 为欲搜寻的字符串，string2 为欲搜寻的字符。 <br/>Int(number) 传回小于或等于接收参数的最大整数值。 <br/>IsArray(varname) 判断一个变量是否为数组型态，若为数组则传回True，反之则为False。 <br/>Day(datetime) 依接收的日期参数传回日。 <br/>Eof(filenumber) 当抵达一个被开启的档案结尾时会传回True。 <br/>Exp(number) 依接收的参数传回e 的次方值。 <br/>FileDateTime(pathname) 传回档案建立时的日期、时间。 <br/>FileLen(pathname) 传回档案的长度，单位是Byte。 <br/>Filter(sourcearray, match[, include[, compare]]) 搜寻字符串数组中的指定字符串，凡是数组元素中含有指定字符串，会将它们结合成新的字符串数组并传回。若是要传回不含指定字符串的数组元素，则include 参数设为False。compare 参数则是设定搜寻时是否区分大小写，此时只要给TextCompare 常数或1 即可。 <br/>Fix(number) 去掉参数的小数部分并传回。 <br/>Format(expression[, style[, firstdayofweek[, firstweekofyear]]]) 将日期、时间和数值资料转为每个国家都可以接受的格式。 <br/>FormatCurrency(expression[,numdigitsafterdecimal [,includeleadingdigit]]) 将数值输出为金额型态。 <br/>numdigitsafterdecimal 参数为小数字数，includeleadingdigit 参数为当整数为0 时是否补至整数字数。 <br/>CObj(expression) 转换表达式为Object 型态。 <br/>CShort(expression) 转换表达式为Short 型态。 <br/>CSng(expression) 转换表达式为Single 型态。 <br/>CStr(expression) 转换表达式为String 型态。 <br/>Choose (index, choice-1[, choice-2, ... [, choice-n]]) 以索引值来选择并传回所设定的参数。 <br/>Chr(charcode) 以ASCII 码来取得字符内容。 <br/>Close(filenumberlist) 结束使用Open 开启的档案。 <br/>Cos(number) 取得一个角度的余弦值。 <br/>Ctype(expression, typename) 转换表达式的型态。 <br/>DateAdd(dateinterval, number, datetime) 对日期或时间作加减。 <br/>DateDiff(dateinterval, date1, date2) 计算两个日期或时间间的差值。 <br/>DatePart (dateinterval, date) 依接收的日期或时间参数传回年、月、日或时间。 <br/>DateSerial(year, month, day) 将接收的参数合并为一个只有日期的Date 型态的数据。 <br/>Datevalue(datetime) 取得符合国别设定样式的日期值，并包含时间。 <br/>Abs(number) 取得数值的绝对值。 <br/>Asc(String) 取得字符串表达式的第一个字符ASCII 码。 <br/>Atn(number) 取得一个角度的反正切值。 <br/>CallByName (object, procname, usecalltype,[args()]) 执行一个对象的方法、设定或传回对象的属性。 <br/>CBool(expression) 转换表达式为Boolean 型态。 <br/>CByte(expression) 转换表达式为Byte 型态。 <br/>CChar(expression) 转换表达式为字符型态。 <br/>CDate(expression) 转换表达式为Date 型态。 <br/>CDbl(expression) 转换表达式为Double 型态。 <br/>CDec(expression) 转换表达式为Decimal 型态。 <br/>CInt(expression) 转换表达式为Integer 型态。 <br/>CLng(expression) 转换表达式为Long 型态 <br/><br/></div></blockquote><br/><br/>]]></description><category>VB.NET</category><comments>http://www.maple.hk/archives/20060309/80/#comment</comments><wfw:comment>http://www.maple.hk/</wfw:comment><wfw:commentRss>http://www.maple.hk/feed.asp?cmt=80</wfw:commentRss><trackback:ping>http://www.maple.hk/cmd.asp?act=tb&amp;id=80&amp;key=6e1618ee</trackback:ping></item><item><title>asp.net(vb)学习笔记2</title><author>credmaple@msn.com (credmaple)</author><link>http://www.maple.hk/archives/20060309/79/</link><pubDate>Thu, 09 Mar 2006 09:30:13 +0800</pubDate><guid>http://www.maple.hk/archives/20060309/79/</guid><description><![CDATA[天啊！原来以为有asp的基础，现在学起asp.net来会非常的应手。哪知道.net竟然非常的烦琐，如果只记里面的控件就需要一段时间，在加上里面常用类库里面的对象。天啊！.net并非一件容易的事。<br/><br/>这二天的感受就是对ado.net的理解，并非是以前那种用rs的概念。ado.net采用了二个新的读取方式，一个是dataset()，一个是datareader()。<br/><br/>dataset()是提取数据库内容放到内存中做检索型数据的存放，读取、插入、删除的使用的时候直接对内存中的dataset数据做操作但不直接发给数据库，只是做个标记。dataset()会定时的与数据库做比较更新。<br/><br/>datareader则比较简单，只能对数据库作查询的操作。<br/><br/>先是这些。<br/>]]></description><category>VB.NET</category><comments>http://www.maple.hk/archives/20060309/79/#comment</comments><wfw:comment>http://www.maple.hk/</wfw:comment><wfw:commentRss>http://www.maple.hk/feed.asp?cmt=79</wfw:commentRss><trackback:ping>http://www.maple.hk/cmd.asp?act=tb&amp;id=79&amp;key=7781abd5</trackback:ping></item><item><title>页间的变量传递与接收</title><author>credmaple@msn.com (credmaple)</author><link>http://www.maple.hk/archives/20060301/74/</link><pubDate>Wed, 01 Mar 2006 15:27:51 +0800</pubDate><guid>http://www.maple.hk/archives/20060301/74/</guid><description><![CDATA[发送页<br/><blockquote><div class="quote"><script language ="vb" runat ="server" ><br/>    Sub button_click(ByVal sender As Object, ByVal e As EventArgs)<br/>        Dim url1<br/>        url1 = "Default3.aspx?xingming=" & Server.UrlEncode(xinming.Text) & "&yong=" & Server.UrlEncode(yong.Text) & "&sex=" & Server.UrlEncode(sex.Text)<br/>        'Response.Redirect(url1)<br/>        Server.Transfer(url1)<br/>    End Sub<br/>        <br/></script>    <br/><form id="form1" runat="server">    <div align="center">        姓名：<asp:TextBox ID="xinming" runat="server"></asp:TextBox><br /><br/>        年龄：<asp:TextBox ID="yong" runat="server"></asp:TextBox><br /><br/>        性别：<asp:TextBox ID="sex" runat="server"></asp:TextBox><br /><br/>        <br /><br/>        <asp:Button ID="Button1" runat="server" Text="Button" OnClick ="button_click" /><br /><br/>        <br /><br/>        <asp:Label ID="memory1" runat="server" Font-Bold="False" Height="32px"<br/>            Width="504px"></asp:Label><br /><br/>        <hr /><br/><br/></div>    </form></div></blockquote><br/><br/>接收页<br/><br/><blockquote><div class="quote"><% <br/>    xingming.Text = Request("xingming")<br/>    yong.Text = Request("yong")<br/>    sex.Text = Request("sex")<br/>%><br/><br/>    <br/>  <br/>    <form id="form1" runat="server">    <div align="center" >        姓名：<asp:Label ID="xingming" runat="server" Width="200px"></asp:Label><br /><br/>        年龄：<asp:Label ID="yong" runat="server" Width="200px"></asp:Label><br /><br/>        性别：<asp:Label ID="sex" runat="server" Width="200px"></asp:Label><br /><br/>        <br/></div>    </form><br/></div></blockquote><br/><br/>接收页用的是尖括号方式接收的变量，而没有用<scrip language="vb">这种运行脚本的方式，因为用那种脚本的方式总显示不成功，可能是由于不执行request的问题取不出字符串提供的变量。]]></description><category>VB.NET</category><comments>http://www.maple.hk/archives/20060301/74/#comment</comments><wfw:comment>http://www.maple.hk/</wfw:comment><wfw:commentRss>http://www.maple.hk/feed.asp?cmt=74</wfw:commentRss><trackback:ping>http://www.maple.hk/cmd.asp?act=tb&amp;id=74&amp;key=dacb489c</trackback:ping></item></channel></rss>
