简体   繁体   English

如何学习Enterprise Library 4.0?

[英]How can I learn Enterprise Library 4.0?

I'm trying to learn the Enterprise Library. 我正在尝试学习企业库。 I found this useful code sample to get data from a SQL database. 我找到了这个有用的代码示例来从SQL数据库中获取数据。 But I tried to send data via a parameter. 但我试图通过参数发送数据。 I'm also using the UPDATE, DELETE, and SAVE methods. 我也在使用UPDATE,DELETE和SAVE方法。 Can you give me a similar sample? 你能给我一个类似的样品吗? I'm using Enterprise Library 4.0. 我正在使用Enterprise Library 4.0。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Microsoft.Practices.EnterpriseLibrary.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace WebApplicationForEnterpirires
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Database objdbase = DatabaseFactory.CreateDatabase("connectionString");
            DataSet ds = objdbase.ExecuteDataSet(CommandType.StoredProcedure, "sp_GetProducts");
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
    }
}

You might find these handy http://msdn.microsoft.com/en-us/magazine/cc188705.aspx http://msdn.microsoft.com/en-us/magazine/cc188702.aspx 你可能会发现这些方便的http://msdn.microsoft.com/en-us/magazine/cc188705.aspx http://msdn.microsoft.com/en-us/magazine/cc188702.aspx

and this >>one<< which targets your situation directly (I think). 这个>>一个“直接针对你的情况(我认为)。 Although I think what you want to do there, is pass the DbCommand object into your ExecuteDataSet method. 虽然我认为你想要做的是将DbCommand对象传递给你的ExecuteDataSet方法。

First of all. 首先。 Go to Microsoft download center for downloading Hand-on Labs . 转到Microsoft下载中心以下载动手实验 The Hand-on Labs has all you need in side (tutorial doc, sample code, exercise...etc). 动手实验室拥有您需要的一切(教程文档,示例代码,练习等)。 Just follow each steps with tutorial of every block. 只需按照每个块的教程执行每个步骤。 Then you could totally understand how to use the Enterprise Library in just few days. 然后,您可以在几天内完全了解如何使用企业库。

Also, check out the new Developer's Guide . 另外,请查看新的开发人员指南 It incldues code sampels in both C# and VB. 它在C#和VB中都包含代码样例。 Happy learning! 快乐学习!

Have you tried this . 你试过这个吗? This gives an example on how you can use the enterprise lib. 这给出了一个如何使用企业库的示例。 to get DataSet passing a parameter. 获取DataSet传递参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM