易截截图软件、单文件、免安装、纯绿色、仅160KB

asp.net连接access数据库进行添加更新删除查询操作

连接access数据库代码,写在一个单独的类里
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
namespace AppWebDLL
{
    public class ConnApp
    {
        public OleDbConnection getCon() {
          
            string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+System.Web.HttpContext.Current.Server.MapPath("App_Data\\UserDB.mdb")+";Jet OLEDB:Database Password=admin";
            OleDbConnection objConnection = new OleDbConnection(strConnection);
            return objConnection;
        }
    }
}
我这习惯这样写的,在这里System.Web.HttpContext.Current.Server.MapPath是用来取得access的相对路径的,在这个类里想要使用System.Web.HttpContext.Current.Server.MapPath,先要引用system.web这个类。
增删改查代码,以我的类写的,这里要注意一个,如果你的字段和access的关键字一样,那么你就要在你的字段上加 [ ],如password是access的关键字,如果你的字段有这个,你在做操作的时候就要这样写[password]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AppWebDLL;
using System.Data;
using System.Data.OleDb;
using System.Collections;
namespace AppBLL
{
public class Land
{
ConnApp capp = new ConnApp();
OleDbConnection db;
OleDbCommand olecom = null;
//查询所有用户
public ArrayList GetAllUser() {
ArrayList alluserlist = new ArrayList();
db = capp.getCon();
try
{
string sql = "select USERNAME from userinfo";
olecom = new OleDbComman


相关文档:

ASP.NET中防止页面多次提交的代码实现

此处提供的代码用来实现当asp.net页面中的某个Button被点击后disable掉该页面中所有的Button,从而防止提交延时导致的多次提交。基于之前的onceclickbutton脚本.
//ASP.NET中防止页面多次提交的代码:javascript< script language=”javascript”> < !– function disableOtherSubmit() {
var obj ......

asp.net生成静态页面

public static void GetHtml(string url,string savepath)//url参数为将要生成的那个动态页面的地址,savepath为要存放地址
{
string Result;
WebResponse MyResponse;
WebRequest MyRequest = System.Net.HttpWebRequest.Create(url);
MyResponse = MyReque ......

给asp.net 网页添加标题、关键字、描述本文

在网页的开发中为了搜索引擎的优化,添加页面的title
keyword description是最常用的方法之一。
asp.net的方法代码如下所示:
 
 
 
 
 
public void SEO_HEAD(string title, string keyword, string
description)
 
 
 
 
 
 
 
{
  ......

Fckeditor配置攻略 asp.net版

网络文本编辑器----Fckeditor之使用篇
1.下载Fckeditor,asp.net版分两部分,FCKeditor和FCKeditor.Net: ASP.Net Control。
官方网站:http://ckeditor.com/download
2.Fckeditor在项目中的集成。
  很简单,不再赘述。
参考文献:http://www.cnblogs.com/zhubo/archive/2008/10/21/using_fckeditor_net.html
常 ......

ASP.NET路径问题小结

1.符号“/”指程序运行所在根目录,即IIs所在目录。
如果iis所在目录为:d:\programs
解决方案为d:\programs\d
网站路径为:d:\programs\d\web\
符号“/”代表的是:d:\programs,不管你的网站前面有多少级,都应该作为一个整体。
2.符号“~/”,则是指网站所在根目录。即d:\programs\ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号