编程技巧 - 文章列表

  • VS2005中获取新增记录的ID方法总结

    1.使用触发器方式\nCREATE TRIGGER intrig ON sales FOR update AS declare @before_id (your title_id’type and length), @after_id (your title_id’type and length) SELECT @before_id =title_id FROM inserted SELECT @after_id

  • C#生成中文汉字验证码源码

    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; using System.Drawing; using System.Tex

  • ASP.NET 2.0中合并 GridView 的表头单元格

    在实际工作中,往往需要合并表格头部的单元格,下面就是一个实现的例子。运行结果如图:C#\n<%@ Page Language=”C#” AutoEventWireup=”true” %>\n<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>\n<script runat=&#822

  • ASP.NET导出文件及 HTTP头信息 文件类型对照

    Response.Clear(); Response.Buffer = true; Response.ContentType=”application/vnd.ms-excel”; Response.AddHeader(“Content-disposition”, “attachment; filename=BillingInformation_”+this.DDL_Mode.SelectedValue+”(“+System.DateTime.Now.ToString(

  • 关于ASP.NET页面打印技术的总结

      网络打印概述\n  • B/S结构导致了Web应用程序中打印的特殊性。\n  • 程序运行在浏览器中,打印机在本地,而文件确可能在服务器上,导致了打印控制不是很灵活。\n  • 格式如何控制和定制等,是我们开发中可能会面对的问题。\n  打印文档的生成\n  • 1、客户端脚本方式\n  一般情况下,主要使用JS 可以分析源页面的内容,将欲打印的页面元素提取出来,实现打印。通过分析源文档的内容,可以生成打印目标文档。\n  优点:客户端独立完成打印目标文档的生成,减轻服务器负荷;\n  缺点:源文档的分析操作复杂,并且源文档中的打印内容要有约

  • 在ASP.NET中创建安全web站点

    以前用ASP,PHP,JSP编写网站代码的时候,站点安全性总是一件头疼的事情,虽然我们编写了用户登录,注册,验证页面,但是效果总是不理想。有时候我们不得不用大量的session变量来存放相关信息,处处设防。而在.NET环境下,这个问题处理起来就非常容易了。关键是要充分理解web.config文件。首先,介绍一下web.config文件。 \n<?xml version=”1.0″ encoding=”utf-8″ ?><configuration><system.web><!– 动态调试编

  • 如何在c#中操作txt文本文件

    \n// C#文本文件操作\n//如何向现有文件中添加文本\n\nusing System;using System.IO;\nclass Test {\npublic static void Main() {\n// Create an instance of StreamWriter to write text to a file. // The using statement also closes the StreamWriter. using\n(StreamWriter sw = new StreamWriter(“TestFile.

  • ASP.NET实例:在GridView使用HyperLinkField 属性的链接

    源程序如下:<asp:GridView ID=”GridView1″ runat=”server” AllowPaging=”True” AllowSorting=”True” AutoGenerateColumns=”False” CellPadding=”4″ DataKeyNames=”LunWBH,LunWBT,ZhuangTMC” ForeColor=”#333333″ GridLines

  • 以xml数据源作无限级联动下拉框

    1.当前要准备好js,下面的代码在网上下的,作者不可考,向这位IT工作者致敬! linkage.js (仅在changeLinkage方法中加入一个SetAssociatedDropDownListValue(element);) 此js库依赖于prototype.js而运行,网上到处有下的var Linkage = Class.create();Linkage.prototype = { initialize : function(dataSrc, xmlFile) { this.dataSrc = dataSrc; this.xmlFile = xmlFi

  • C#.NET函数和方法集

    c#.net函数和方法集(大家一起来加啊) \n1、DateTime 数字型 System.DateTime currentTime=new System.DateTime(); 1.1 取当前年月日时分秒 currentTime=System.DateTime.Now; 1.2 取当前年 int 年=currentTime.Year; 1.3 取当前月 int 月=currentTime.Month; 1.4 取当前日 int 日=currentTime.Day; 1.5 取当前时 int 时=currentTime.Hour; 1.6 取当前分 int 分=currentTime.Minu