CQ-CSER

计算机爱好者

微软企业库DAAB4.1试用

Posted on | 三月 24, 2010 | No Comments

下面2个系列讲的都不错

http://www.cnblogs.com/Terrylee/archive/2006/07/03/enterprise_library2_1.html

http://www.cnblogs.com/HCOONa/category/172235.html

下面是MSDN的大牛

http://blogs.msdn.com/tomholl/archive/tags/Enterprise+Library/default.aspx

按他的说法搞了到最后也没用起来Enterprise Library Configuration,反倒是直接reference和using了OK

123

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using Microsoft.Practices.EnterpriseLibrary.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;
using System.Text;
using System.Data.Common;
namespace WebApplication1
{
public partial class ListSection : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{  //Database db = DatabaseFactory.CreateDatabase();
///创建数据库实例
Database db = DatabaseFactory.CreateDatabase(“NorthWind”);
string sqlcommand = “SELECT id,name,[order] FROM section ORDER BY [ORDER]“;
DbCommand dbcommand = db.GetSqlStringCommand(sqlcommand);
//  string sConnectionString = @”server=(local)\SQLEXPRESS;datebase=Forum;Trusted_Connection=Ture”;
StringBuilder readData = new StringBuilder();
using (IDataReader datareader=db.ExecuteReader(dbcommand))
{
readData.Append(“<ul id=\”section_list\”>”);
while(datareader.Read())
{
readData.Append(“<li id=\”");
readData.Append(“li_”+datareader["id"]);
readData.Append(“\”>”);
readData.Append(datareader["name"]);
readData.Append(“</li>”);
}
readData.Append(“</ul>”);
}
Response.Write(readData.ToString());
}
}
}

相关文章:

  1. 分页控件/分页类
  2. one Windows后台服务(.Net的C#版)
  3. C#创建Excel文件
  4. DES加密解密函数 收藏 c#
  5. ASP.NET加密Cookies

评论|Comments

留言|Leave a Reply





  • Archives

  • SUNSHINE

  • About

    本博客采用创作共用版权协议,要求署名、非商业用途和保持一致. 转载本博客内容也遵循“署名-非商业用途-保持一致”的创作共用协议.

    订阅

    Search

    Admin