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.

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews