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

ASP.NET DBHelper类

using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Data.Common;
using System.Data;
namespace DownData.dal
{
    public static class DBHelper
    {
        private static readonly string connectionString =
            "Data Source=.\\newdb;Initial Catalog=downloaddata; uid=sa;pwd=sa";
        private static readonly string providerName ="System.Data.SqlClient";
        //GetConnection 用于获取连接数据库的 connection 对象...
        private static DbConnection GetConnection()
        {
            DbProviderFactory _factory = DbProviderFactories.GetFactory(providerName);
            DbConnection connection = _factory.CreateConnection();
            connection.ConnectionString = connectionString;
            return connection;
        }
        //GetCommand 获取命令参数 command 对象...
        private static DbCommand GetCommand(string commandText, CommandType commandType, DbConnection connection)
        {
            DbCommand command = connection.CreateCommand();
            command.CommandText = commandText;
            command.CommandType = commandType;
          


相关文档:

认识ASP.NET配置文件Web.config

一、认识Web.config文件
Web.config文件是一个XML文本文件,它用来储存 ASP.NET Web 应用程序的配置信息(如最常用的设置ASP.NET Web 应用程序的身份验证方式),它可以出现在应用程序的每一个目录中。当你通过VB.NET新建一个Web应用程序后,默认情况下会在根目录自动创建一个默认的
Web.config文件,包括默认的配置设置 ......

ASP.NET面试题(一)

SP.NET面试题
(转 原文地址http://blog.sina.com.cn/s/blog_524c848901009e7b.html~type=v5_one&label=rela_nextarticle 作者
李洋的博客
http://blog.sina.com.cn/liiyang)
1. 简述 private、 protected、 public、 internal 修饰符的访问权限。
答 . private : 私有成员, 在类的内部才可以访问。
prote ......

ASP.NET MVC 入门5、View与ViewData

本系列文章基于ASP.NET MVC Preview5.
view在MVC模式中与用户进行最直接的接触,它负责数据的呈现。这里要注意一点就是,view只是负责数据的呈现,所以我们应该要尽量让
view中不涉及业务逻辑的处理。
我们来添加一个Blog首页的view。在安装了ASP.NET MVC后,我们在添加新项目的时候可以看到有MVC的view模板:
 
......

JS重置按钮脚本,支持重置ASP.NET控件

开发中经常遇到要重置控件值得操作,下面写了常用HTML控件的重置方法。不完整的,大家可以扩充
function ResetControl() {
            var v = document.forms[0].elements;
            for (var i = ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号