易截截图软件、单文件、免安装、纯绿色、仅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页面刷新方法总结

先看看ASP.NET页面刷新的实现方法:
第一:
C# code
private void Button1_Click( object sender, System.EventArgs e )
{
Response.Redirect( Request.Url.ToString( ) );
}
第二:
C# code
private void Button2_Click( object sender, System.EventArgs e )
{
Response.Write( " < script lang ......

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号