Thursday, March 1, 2007

Filling typed dataset with enterprise libary 2006-C#

Here is the code filling data with enterprise library.

First Create a Type dataset in the visual studio dataset called 'crystal'.
Then create a data table via right click add datatable called script.create
columns you require.

and then first import following name space using directives.

using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary;
using System.Data;
using System.Data.Common;

Database db = DatabaseFactory.CreateDatabase("StockConnectionString");
private string _CommandName;
_CommandName = "sp_LoadScript";
DbCommand dbCommand = db.GetStoredProcCommand(_CommandName);
db.AddInParameter(dbCommand, "Name", DbType.String, "abc");
db.LoadDataSet(dbCommand, Crystal, "script");

here sp_Loadscript is a sql server 2005 stored procedure which load
script.
Share:

0 comments:

Post a Comment

Your feedback is very important to me. Please provide your feedback via putting comments.

About Me
My Photo

Full Stack Developer,Blogger,Microsoft Mvp, Mentor, Life long learner, 10+ Years of Experience for JavaScript, web and Microsoft technologies. ASP.NET MVC,Web Forms,C#,AngularJs,Golang
Mvp profile
Subscribe to my blog

Enter your email address:

Follow us on facebook
Blog Archive
Total Pageviews