Click here to Skip to main content
15,892,797 members
Articles / Programming Languages / C#

Using Microsoft Enterprise Library Data Access Application Block – Part II

Rate me:
Please Sign up or sign in to vote.
3.07/5 (16 votes)
7 Aug 2009CPOL3 min read 89.5K   1.3K   28  
Using Microsoft Enterprise Library Data Access Application Block to Retrieve Data from Database.
��SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_PADDING ON

GO

CREATE TABLE [dbo].[tblUserMaster](

	[UserID] [int] IDENTITY(1,1) NOT NULL,

	[UserName] [varchar](50) NOT NULL,

	[UserPassword] [varchar](16) NOT NULL,

	[FirstName] [varchar](50) NOT NULL,

	[LastName] [varchar](50) NULL,

	[IsDeleted] [bit] NOT NULL CONSTRAINT [DF_tblUserMaster_IsActive]  DEFAULT ((0)),

	[RegistrationDate] [datetime] NOT NULL CONSTRAINT [DF_tblUserMaster_RegistrationDate]  DEFAULT (getdate()),

 CONSTRAINT [PK_tblUserMaster] PRIMARY KEY CLUSTERED 

(

	[UserID] ASC

)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

) ON [PRIMARY]



GO

SET ANSI_PADDING OFF



GO





CREATE PROCEDURE [dbo].[sprocSample_GetActiveUsers]

AS 

BEGIN

SET NOCOUNT ON

	SELECT UserID, UserName, FirstName, LastName, UserPassword  FROM tblUserMaster WHERE IsDeleted = 0

END





GO



CREATE PROCEDURE [dbo].[sprocSample_GetUserDetails]

@intUserID INT,

@intErrID int OUT,

@strMessage varchar(255) OUT

AS 

BEGIN

SET NOCOUNT ON

	IF EXISTS(SELECT 1 FROM dbo.tblUserMaster WHERE UserID = @intUserID AND IsDeleted = 0)

		BEGIN

			SELECT UserID, UserName, FirstName, LastName, UserPassword  FROM tblUserMaster WHERE UserID = @intUserID

		END

	ELSE

		BEGIN

			SET @intErrID = -3

			set @strMessage = 'User does not exists'

		END

END







By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions