Click here to Skip to main content
15,886,724 members
Articles / Web Development / ASP.NET

Implement CRUD Operations using RESTful WCF Service and JavaScript

Rate me:
Please Sign up or sign in to vote.
4.87/5 (24 votes)
15 Sep 2011CPOL5 min read 136K   11.4K   137  
Easy way to consume WCF REST services through JQuery and perform CRUD (Create Retrieve Update Delete) operations
��/****** Object:  Table [dbo].[Members]    Script Date: 09/16/2011 14:15:14 ******/

IF  EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[DF_Members_Date_Started]') AND type = 'D')

BEGIN

ALTER TABLE [dbo].[Members] DROP CONSTRAINT [DF_Members_Date_Started]

END

GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Members]') AND type in (N'U'))

DROP TABLE [dbo].[Members]

GO

/****** Object:  Table [dbo].[Members]    Script Date: 09/16/2011 14:15:14 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Members]') AND type in (N'U'))

BEGIN

CREATE TABLE [dbo].[Members](

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

	[ScreenName] [nvarchar](50) NULL,

	[Password] [nvarchar](50) NULL,

	[Email] [nvarchar](50) NULL,

	[CreateDate] [datetime] NULL CONSTRAINT [DF_Members_Date_Started]  DEFAULT (getdate()),

 CONSTRAINT [PK_Table_1] PRIMARY KEY CLUSTERED 

(

	[Member_Id] ASC

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

) ON [PRIMARY]

END

GO

SET IDENTITY_INSERT [dbo].[Members] ON

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (2, N'test2', N'12345', N'test2@yahoo.com', CAST(0x00009F5D00F9E93D AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (3, N'test3', N'12345', N'test3@yahoo.com', CAST(0x00009F5D00F9FF12 AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (4, N'test4', N'12345', N'test4@yahoo.com', CAST(0x00009F5D00FA0CAD AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (5, N'test5', N'12345', N'test5@yahoo.com', CAST(0x00009F5D00FA1B8E AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (6, N'test6', N'12345', N'test6@yahoo.com', CAST(0x00009F5D00FA6633 AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (7, N'test7', N'12345', N'test7@yahoo.com', CAST(0x00009F5D00FA738B AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (8, N'test8', N'12345', N'test8@yahoo.com', CAST(0x00009F5D00FA81AE AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (9, N'test9', N'12345', N'test9@yahoo.com', CAST(0x00009F5D00FAB73C AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (10, N'test10', N'12345', N'test10@yahoo.com', CAST(0x00009F5D00FAE328 AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (11, N'test11', N'12345', N'test11@yahoo.com', CAST(0x00009F5D00FAF69E AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (12, N'test12', N'12345', N'test12@yahoo.com', CAST(0x00009F5D00FB08D9 AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (13, N'test13', N'12345', N'test13@yahoo.com', CAST(0x00009F5D00FB1CB1 AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (14, N'test14', N'12345', N'test14@yahoo.com', CAST(0x00009F5D00FC689E AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (15, N'test15', N'12345', N'test15@yahoo.com', CAST(0x00009F5D00FC764C AS DateTime))

INSERT [dbo].[Members] ([Member_Id], [ScreenName], [Password], [Email], [CreateDate]) VALUES (16, N'test17', N'12345', N'test17@yahoo.com', NULL)

SET IDENTITY_INSERT [dbo].[Members] OFF

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)


Written By
Chief Technology Officer
Bangladesh Bangladesh
I am a Software Engineer and Microsoft .NET technology enthusiast. Professionally I worked on several business domains and on diverse platforms. I love to learn and share new .net technology and my experience I gather in my engineering career. You can find me from here

Personal Site
Personal Blog
FB MS enthusiasts group
About Me

Comments and Discussions