Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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. But I tried to send data via a parameter. I'm also using the UPDATE, DELETE, and SAVE methods. Can you give me a similar sample? I'm using 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();
        }
    }
}
like image 477
loki Avatar asked Dec 23 '22 04:12

loki


1 Answers

You might find these handy 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.

like image 76
pms1969 Avatar answered Jan 05 '23 20:01

pms1969