10 2012 档案

摘要:using System; using System.Data; using System.Xml; using System.Data.SqlClient; using System.Collections; using System.Configuration;namespace BookDAL { /// <summary> /// SqlServer数据访问帮助类 /// </summary> public sealed class SqlHelper { #region 私有构造函数和方法 private SqlHelper() { } /// <sum 阅读全文
posted @ 2012-10-27 15:28 蓬莱仙羽 阅读(244) 评论(0) 推荐(0)
摘要:static string sqlcon = "server=.;database=;Integrated Security=true;";/// <summary>/// 新增数据/// </summary>public static void Add(){ //string sqlcon = "server=.;database=;Integrated Security=true;"; SqlConnection conn=new SqlConnection(sqlcon); string sqlStr="inser 阅读全文
posted @ 2012-10-26 11:22 蓬莱仙羽 阅读(187) 评论(0) 推荐(0)
摘要:using System;using System.Text;using System.Net.Sockets;using System.Net.Mail;using System.Net;namespace DotNet.Utilities{ /// <summary> /// 网络操作相关的类 /// </summary> public class NetHelper { #region 检查设置的IP地址是否正确,返回正确的IP地址 /// <summary> /// 检查设置的IP地址是否正确,并返回正确的IP地址,无效IP地址返回"-1& 阅读全文
posted @ 2012-10-26 00:21 蓬莱仙羽 阅读(365) 评论(0) 推荐(0)
摘要:using System.Xml;using System.Data;namespace DotNet.Utilities{ /// <summary> /// Xml的操作公共类 /// </summary> public class XmlHelper { #region 字段定义 /// <summary> /// XML文件的物理路径 /// </summary> private string _filePath = string.Empty; /// <summary> /// Xml文档 /// </summary& 阅读全文
posted @ 2012-10-26 00:13 蓬莱仙羽 阅读(321) 评论(0) 推荐(0)
摘要:using System.Web;namespace DotNet.Utilities{ /// <summary> /// 客户端脚本输出 /// </summary> public class JsHelper { /// <summary> /// 弹出信息,并跳转指定页面。 /// </summary> public static void AlertAndRedirect(string message, string toURL) { string js = "<script language=javascript> 阅读全文
posted @ 2012-10-26 00:12 蓬莱仙羽 阅读(220) 评论(0) 推荐(0)
摘要:using System.Text;namespace DotNet.Utilities{ //页面中弹出对话框 public class MessageBox { private MessageBox() { } #region 显示消息提示对话框 /// <summary> /// 显示消息提示对话框 /// </summary> /// <param name="page">当前页面指针,一般为this</param> /// <param name="msg">提示信息</para 阅读全文
posted @ 2012-10-26 00:10 蓬莱仙羽 阅读(137) 评论(0) 推荐(0)
摘要:using System;using System.Text;using System.Web;using System.IO;namespace DotNet.Utilities{ public class FileOperate { #region 写文件 protected void Write_Txt(string FileName, string Content) { Encoding code = Encoding.GetEncoding("gb2312"); string htmlfilename = HttpContext.Current.Server.Ma 阅读全文
posted @ 2012-10-26 00:08 蓬莱仙羽 阅读(139) 评论(0) 推荐(0)
摘要:using System;using System.Text;using System.IO;namespace DotNet.Utilities{ /// <summary> /// 文件操作夹 /// </summary> public static class DirFile { #region 检测指定目录是否存在 /// <summary> /// 检测指定目录是否存在 /// </summary> /// <param name="directoryPath">目录的绝对路径</param> 阅读全文
posted @ 2012-10-26 00:07 蓬莱仙羽 阅读(145) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Text;using System.Text.RegularExpressions;namespace DotNet.Utilities{ /// <summary> /// 字符串操作类 /// 1、GetStrArray(string str, char speater, bool toLower) 把字符串按照分隔符转换成 List /// 2、GetStrArray(string str) 把字符串转 按照, 分割 换为数据 /// 3、GetArraySt 阅读全文
posted @ 2012-10-26 00:05 蓬莱仙羽 阅读(909) 评论(0) 推荐(0)
摘要:#region set connection string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source= "+this.txtPath.Text+";Extended Properties=Excel 8.0;"; myDataReader = null; craboDbConnection = new OleDbConnection(strConn); OleDbCommand myOleDbCommand = new OleDbCommand("SELECT * FROM 阅读全文
posted @ 2012-10-24 16:02 蓬莱仙羽 阅读(159) 评论(0) 推荐(0)
摘要:using System;using System.Windows.Forms;namespace WindowsFormsApplication2{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Uri address = new Uri(textBox1.Text);//创建uri类型变量,存储浏览网页地址 webBrowser1.Url = address; } pr 阅读全文
posted @ 2012-10-23 21:42 蓬莱仙羽 阅读(161) 评论(0) 推荐(0)
摘要:protected void Upload() { //判断是否选择文件 if (FileUpload1.HasFile) { string fileContentType = FileUpload1.PostedFile.ContentType;//获取文件类型 //判断类型是否符合条件 if (fileContentType == "image/bmp" || fileContentType == "image/gif" || fileContentType == "image/pjpeg"||fileContentType==& 阅读全文
posted @ 2012-10-22 20:25 蓬莱仙羽 阅读(212) 评论(0) 推荐(0)
摘要:using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;public partial class CalendarThree : System.Web. 阅读全文
posted @ 2012-10-22 16:30 蓬莱仙羽 阅读(281) 评论(0) 推荐(0)
摘要:如何运用内置对象session和application对象实现统计在线人数首先创建一个全局应用程序类Global.asaxprotected void Application_Start(object sender, EventArgs e) { if (Application["CountOnline"] == null) { Application["CountOnline"] = 0; } } //设置session对象,生存时间为1分钟 protected void Session_Start(object sender, EventArgs e 阅读全文
posted @ 2012-10-22 16:01 蓬莱仙羽 阅读(174) 评论(1) 推荐(0)
摘要:(一).Web.Config是以XML文件规范存储,配置文件分为以下格式 1.配置节处理程序声明 特点: 位于配置文件的顶部,包含在<configSections>标志中。 2.特定应用程序配置 特点: 位于<appSetting>中。 可以定义应用程序的全局常量设置等信息. 3.配置节设置 特点: 位于<system.Web>节中,控制Asp.net运行时的行为. 4.配置节组 特点: 用<sectionGroup>标记,可以自定义分组,可以放到<configSections>内部或其它<sectionGroup>标记的 阅读全文
posted @ 2012-10-22 15:09 蓬莱仙羽 阅读(171) 评论(0) 推荐(0)
摘要:Server.MapPath() ./当前目录/网站主目录../上层目录~/网站虚拟目录如果当前的网站目录为E:\wwwroot 应用程序虚拟目录为E:\wwwroot\company 浏览的页面路径为E:\wwwroot\company\news\show.asp在show.asp页面中使用Server.MapPath("./") 返回路径为:E:\wwwroot\company\newsServer.MapPath("/") 返回路径为:E:\wwwrootServer.MapPath("../") 返回路径为:E:\wwwroo 阅读全文
posted @ 2012-10-15 19:56 蓬莱仙羽 阅读(133) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Net;using System.Net.Sockets;namespace SocketTest{ class Program { static void Main(string[] args) { int length; byte[] bytes = new byte[1024]; //创建一个Socket对象 Socket socketSend = new Socket(AddressFamily.I 阅读全文
posted @ 2012-10-13 16:58 蓬莱仙羽 阅读(173) 评论(0) 推荐(0)