易截截图软件、单文件、免安装、纯绿色、仅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比较完整的流程

如果你已经有较多的面向对象开发经验,跳过以下这两步:
  第一步 掌握一门.NET面向对象语言,C#或VB.NET 我强烈反对在没系统学过一门面向对象(OO)语言的前提下去学ASP.NET。 ASP.NET是一个全面向对象的技术,不懂OO,那绝对学不下去!
  第二步 对.NET Framework类库有一定的了解 可以通过开发Windows Form应用程 ......

asp.net超链接传值问题

最近开发中在页面之间传递值的过程中,多处应用了超链接传值的方式。但是当传递的参数中含有中文字符时,在调用Request.QueryString[]方法接收参数时,总是出现错误,而且错误的出现总是随机的。表现为接收的中文参数不全,后加通配符“?”,或者把中文参数后的那个参数和中文参数混在一起,不加区分。
 & ......

ASP.NET MVC 入门3、Routing

在一个
route
中,通过在大括号中放一个占位符来定义
(
{ and } )
。当解析
URL
的时候,符号
"/"

"."
被作为一个定义符来解析,而定义符之间的值则匹配到占位
符中。
route
定义中不在大括号中的信息则作为常量值。
下面是一些示例
URL


Valid route definitions
Example ......

ASP.NET MVC 入门4、Controller与Action

本系列文章基于ASP.NET MVC Preview5.
Controller是MVC中比较重要的一部分。几乎所有的业务逻辑都是在这里进行处理的,并且从Model中取出数据。在ASP.NET
MVC
Preview5中,将原来的Controller类一分为二,分为了Controller类和ControllerBase类。Controller类
继承自ControllerBase类,而ControllerBase实现是了ICont ......

asp.net 获取上传图片的大小


System.Drawing.Image imgPhoto = System.Drawing.Image.fromFile("图片路径名");   
int sourceWidth = imgPhoto.Width;   //图片宽度
int sourceHeight = imgPhoto.Height;   //图片高度
控件名.PostedFile.ContentLength &n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号