473,411 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Enterprise Library 2.0 Data Access Application Block

Hello,

Could someone tell me how to run a simple SQL stored procedure using
the Enterprise Library 2.0 Data Access?

I have in my VB.NET code the following database:
Dim db As Database = DatabaseFactory.CreateDatabase

Thanks,
Miguel

Feb 8 '07 #1
3 2355

You need to define whether or not the stored procedure returns rows or not.


"shapper" <md*****@gmail.comwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
Hello,

Could someone tell me how to run a simple SQL stored procedure using
the Enterprise Library 2.0 Data Access?

I have in my VB.NET code the following database:
Dim db As Database = DatabaseFactory.CreateDatabase

Thanks,
Miguel

Feb 8 '07 #2

From memory:

Dim dbCommandWrapper As DatabaseCommandWrapper =
db.GetStoredProcCommandWrapper("dbo.uspSomeProcedu re")

dbCommandWrapper.AddInParameter("@EmpID", DbType.Int,
12345 )

' Output parameters specify the size of the return data
'dbCommandWrapper.AddOutParameter("@numberRowsAffe cted",
DbType.Int32, 0)

Dim rowsAffected As Int32
rowsAffected = db.ExecuteNonQuery(dbCommand)
' there are diffferent methods. ExcecuteReader, LoadDataSet.. you have to
match yours to what you want it to do

Feb 8 '07 #3
Ahh, sorry, I gave you a 1.1 example:

Here is 2.0

private Microsoft.Practices.EnterpriseLibrary.Data.Databas e
GetDatabase()
{
// Create the Database object, using the default database
service. The
// default database service is determined through configuration.
Database db = DatabaseFactory.CreateDatabase();

return db;
}
private void UpdateEmployeeData(int empid )
{
Database db = this.GetDatabase();

DbCommand dbc = db.GetStoredProcCommand("dbo.uspSomeProcedure);

db.AddInParameter(dbc , "@EmpID", DbType.Int32, empid);

db.AddOutParameter(dbc , "@numberRowsAffected", DbType.Int32,
0);

db.ExecuteNonQuery(dbc )

}

"sloan" <sl***@ipass.netwrote in message
news:ep**************@TK2MSFTNGP03.phx.gbl...
>
From memory:

Dim dbCommandWrapper As DatabaseCommandWrapper =
db.GetStoredProcCommandWrapper("dbo.uspSomeProcedu re")

dbCommandWrapper.AddInParameter("@EmpID", DbType.Int,
12345 )

' Output parameters specify the size of the return data
'dbCommandWrapper.AddOutParameter("@numberRowsAffe cted",
DbType.Int32, 0)

Dim rowsAffected As Int32
rowsAffected = db.ExecuteNonQuery(dbCommand)
' there are diffferent methods. ExcecuteReader, LoadDataSet.. you have to
match yours to what you want it to do

Feb 8 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mike Chamberlain | last post by:
Hi all. I'm trying to extend the Microsoft Enterprise Library Data Access Application Block (http://msdn.microsoft.com/library/en-us/dnpag2/html/daab.asp?frame=true) to work with a Borland...
0
by: ad | last post by:
I have used Data Application Access Block2 in my web application. Now I download the Library Data Access Application Block. and read the document. May be I am stupid, I can't migrate it to...
3
by: veera sekhar kota | last post by:
hi, im seriously looking for right answer .... We are developing windows application in c#. I implemented DAAB(Data Access Application Block) 2.0 in our application. One of the senior asked...
0
by: veera sekhar kota | last post by:
im seriously looking for right answer .... We are developing windows application in c#. I implemented DAAB(Data Access Application Block) 2.0 in our application. One of the senior asked me to...
0
by: veera sekhar kota | last post by:
im seriously looking for right answer .... We are developing windows application in c#. I implemented DAAB(Data Access Application Block) 2.0 in our application. One of the senior asked me to...
2
by: bjhogan | last post by:
Hi, I have built an c# asp.net application on my laptop, it uses the Enterprise Library blocks - Data Access Application Block, Configuration Application Block. I now want to deploy my...
0
by: Benny Ng | last post by:
Hi,All, When i deploy Enterprise library with my application ,i used XCOPY to deploy it into my test server. But when application runs, shown some error related registry. (But actually I haven't...
6
by: Jonathan Crawford | last post by:
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +473 Hi I have installed the enterprise library on a development machine and created a project on our webserver. When...
1
by: dhussong | last post by:
I am attempting to use Visual Studio 2005 (Visual Basic) and the Enterprise Library 2.0 Data Access Application Block with a Microsoft Access database. I know the names of my Access databases but I...
7
by: galico | last post by:
Hi All, We are having a very strange problem with the above. We have designed an application in ASP.NET 2.0 that uses the enterprise library data application blocks amongst others. We seem to be...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.