【摘要】本文概要讲述了使用public的属性和变量,并使用Server.Transfer方法在多个页面间传递参数的办法。说明:Server.Transfer无法使用QueryString传递变量注:本站原创,转载请注明本站网址:http://www.beinet.cn/blog/【全文】假设第一个页面为A1.ASPX,有个BUTTON,按下后转向B1.ASPX;在B1.ASPX中要取得A1.ASPX页面的两个TexeBox的内容和一个静态数组的内容。首先,A.ASPX必须使用代码分离的方式,即A1.ASPX代码第一行类似:<%@ Page language="c#" Read More
posted @ 2007-01-07 20:17 attitudedecidesall Views(216) Comments(0) Diggs(0) Edit
//写注册表RegistryKey regWrite;//往HKEY_CURRENT_USER主键里的Software子键下写一个名为“Test”的子键//如果Test子键已经存在系统会自动覆盖它regWrite = Registry.CurrentUser.CreateSubKey("Software\\Test");//往Test子键里添两条数据项,一条名为"Name",另一条名为"Sex"//值分别是"luolie","男"regWrite.SetValue("Name" Read More
posted @ 2007-01-07 20:15 attitudedecidesall Views(143) Comments(0) Diggs(0) Edit
在win32中有ShellExecute方法可以使我们启动外部的应用程序,在 .NET FrameWork 中我们可以使用Process类来完成类似的功能。Process在System.Diagnostics中,所以别忘了: using System.Diagnostics;1) 用Process的静态方法Start//启动记事本Process.Start("notepad.exe");//启动记事本,并打开temp.txt文件 Process.Start("notepad.exe",@"d:\temp.txt"); 此方法最简单,但 Read More
posted @ 2007-01-07 20:12 attitudedecidesall Views(266) Comments(0) Diggs(0) Edit
【摘要】在当前很多项目都要进行多条记录的插入或更新操作,这些操作要么全部执行成功,要么全部执行失败(Rollback),这也是数据库的一致性的要求,这个操作好像叫做:原子性应该是吧。全文给出了一个OleDb的例子,就是使用OleDbTransaction来实现我们的目的,当然SqlServer就应该使用:SqlTransaction 了本站原创,转载请证明:http://beinet.cn/blog【全文】<%@ Page Language="C#" Debug="true" %><%@ Import NameSpace = " Read More
posted @ 2007-01-07 20:10 attitudedecidesall Views(560) Comments(0) Diggs(0) Edit
【摘要】目前很多网站都要提交页面插入或更新数据库,比如留言本,一个用户提交留言后,如果按F5,就会重新提交一遍留言,导致数据库出现两条一模一样的留言,本文介绍了几种防止页面刷新,导致重复提交数据的方法。本站原创,转载请注明: http://beinet.cn/blog/【全文】1、也是最简单和最常用的办法,就是使用转向页面语句,分两种: a.使用服务器端的 Response.Redirect("YourPage"); b.使用客户端脚本 <script language=javascript>location.href='yourPage';&l Read More
posted @ 2007-01-07 20:09 attitudedecidesall Views(170) Comments(0) Diggs(0) Edit
用递归算法实现ASP程序对硬盘上某个路径下目录和文件的遍历 胡磊由于工作需要,要做一个对硬盘上目录的遍历程序,因此想用asp来实现这个功能,便写了一下这段程序。程序中主要用到asp的filesystemobject文件系统对象。可以作为给希望了解和学习fso的朋友们的一个学习程序。文件名称bianli.asp<%@ Language=VBScript %><% function bianli(path) dim fso 'fso对象 dim objFolder '文件夹对象 dim objSubFolders '子文件夹集合 dim objSubFol Read More
posted @ 2007-01-07 20:05 attitudedecidesall Views(274) Comments(0) Diggs(0) Edit
class ExploreFold { static void Main(string[] args) { ExploreFold ef = new ExploreFold(); string theDirectory = @"D:\phproot"; DirectoryInfo dir = new DirectoryInfo(theDirectory); ef.ExploreDirectory(dir); Console.ReadLine(); } private void ExploreDirectory(DirectoryInfo dir) { DirectoryIn Read More
posted @ 2007-01-07 20:04 attitudedecidesall Views(186) Comments(0) Diggs(0) Edit
注:这个代码是模仿“我的电脑”实现的一个简单的网页目录浏览器1、遍历一个目录下的全部目录,要用到System.IO.DirectoryInfo 类的GetDirectories方法:DirectoryInfo dir = new DirectoryInfo(@"c:\"); foreach(DirectoryInfo dChild in dir.GetDirectories("*")){//如果用GetDirectories("ab*"),那么全部以ab开头的目录会被显示Response.Write(dChild.Name + &qu Read More
posted @ 2007-01-07 20:01 attitudedecidesall Views(607) Comments(0) Diggs(0) Edit