今天向公司提交辞职报告了,原因是工资太低了,而且工作太累,干主管的活拿程序员的工资,但是说实话我非常喜欢我现在的工作,但是无奈人总要生活嘛。所以今天是带着非常复杂的心情离开的,听说我即将上班的公司里面的人挺怪的,不过工资倒是蛮高的,我也不知道这次换工作对我来说是不是好事。
posted @ 2010-07-30 20:34 Brids 阅读(75) 评论(1) 编辑
摘要: 代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Web;usingSystem.Web.Security;usin...阅读全文
posted @ 2009-11-27 20:42 Brids 阅读(169) 评论(0) 编辑
摘要: 非原创【只是想和大家分享而已】[代码]阅读全文
posted @ 2009-11-19 17:32 Brids 阅读(254) 评论(5) 编辑
摘要: 功能很简单,如果有什么不足之处,请大家多提出你们的宝贵意见。源代码如下:[代码]阅读全文
posted @ 2009-11-19 17:21 Brids 阅读(165) 评论(2) 编辑

可支持sql,sqlite,access,orcal,Mysql数据库,已编译成dll文件方便大家使用。

使用方法:将web.config 中的

<connectionStrings>

<add connectionString="Server=(local);Database=northwind;Uid=sa;Pwd=123456;" name="ConnectionString" providerName="System.Data.SqlClient"/>
 </connectionStrings>

注意name属性不能更改,在使用不同数据库是之需要将providerName改成对应的就可以了

如果为Mysql  数据库--->providerName="MySql.Data.MySqlClient"

如果为Aceess数据库--->providerName="System.Data.OleDb"

如果为Oracle 数据库--->providerName="System.Data.OracleClient"或者providerName="Oracle.DataAccess.Client"

如果为SQLite数据库--->providerName="System.Data.SQLite"

如果为sql     数据库--->providerName="System.Data.SqlClient"

 

页面中的使用方法,

先引入命名空间

using System.Data.Utilities;

使用方法:

DbHelper db = DbHelperFactory.Instance();

里面的方法包括15种,支持带参数得sql语句和带参数得存储过程

当然在使用过程中如果发现什么错误或者不足,欢迎大家指正。

文件下载地址:http://d.namipan.com/d/e2222aaa35974e41baf9119bffd618049d4c744700840000

 

posted @ 2009-11-19 17:06 Brids 阅读(388) 评论(6) 编辑

新建一个类:名字为:CommonClass.cs

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Text;
using System.Drawing;

/// <summary>
///CommonClass 的摘要说明
/// </summary>
public class CommonClass
{
 public CommonClass()
 {
  //
  //TODO: 在此处添加构造函数逻辑
  //
    }
    public static void ReportToExcel(System.Web.UI.Control ctl, string fileName)
    {
        //HttpContext.Current.Response.Clear();
        //HttpContext.Current.Response.Buffer = true;
        HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF7;
        HttpContext.Current.Response.ContentType = "application/ms-excel";
        HttpContext.Current.Response.Charset = "gb2312";
        HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileName + ".xls", Encoding.UTF8).ToString());
        ClearChildControls(ctl);
        StringWriter sw = new StringWriter();
        HtmlTextWriter htw = new HtmlTextWriter(sw);
        ctl.RenderControl(htw);
        HttpContext.Current.Response.Write(sw.ToString());
        HttpContext.Current.Response.End();
    }
    private static void RecursiveClear(Control control)
    {

        for (int i = control.Controls.Count - 1; i >= 0; i--)
        {
            RecursiveClear(control.Controls[i]);
        }

        if (control is Repeater)
        {
            control.Parent.Controls.Remove(control);
        }
        else if (control is LinkButton)
        {
            LiteralControl literal = new LiteralControl();
            control.Parent.Controls.Add(literal);
            literal.Text = ((LinkButton)control).Text;
            control.Parent.Controls.Remove(control);
        }
        else if (control is Button)
        {
            control.Parent.Controls.Remove(control);
        }

        else if (control is System.Web.UI.WebControls.Image)
        {
            if (((System.Web.UI.WebControls.Image)control).Visible)
            {
                control.Parent.Controls.Add(new LiteralControl("<span style='font-size:8px;'>o</span>"));
            }
            control.Parent.Controls.Remove(control);
        }
        else if (control is ListControl)
        {
            LiteralControl literal = new LiteralControl();
            control.Parent.Controls.Add(literal);
            try
            {
                literal.Text = ((ListControl)control).SelectedItem.Text;
            }
            catch
            {
            }
            control.Parent.Controls.Remove(control);

        }

        return;
    }
    protected static void ClearChildControls(Control dg1)
    {
        if (dg1 is GridView)
        {
            GridView dg = (GridView)dg1;
            for (int i = dg.Columns.Count - 1; i >= 0; i--)
            {
                if (dg.Columns[i].GetType().Name == "ButtonColumn"
                    || dg.Columns[i].GetType().Name == "CheckBoxField"
                    || dg.Columns[i].GetType().Name == "CommandField")
                {
                    dg.Columns[i].Visible = false;
                }
            }
            RecursiveClear(dg1);
        }
        else
        {
            RecursiveClear(dg1);
        }
    }
}

引用方法:CommonClass.GridViewExport(GridView1,"测试导出到EXCEL");

该方法可将DetailsView,DataList,GridView中的数据导出到Excel中,已经过本人测试。

下载该例子:ReportToExccel.rar

posted @ 2009-04-29 22:43 Brids 阅读(979) 评论(0) 编辑