.NET Remoting Part One .

In this part we will define all the required interface to perform CRUD operation . We will use windows form application to as client interface .First we need to create required tables and store procedure into sql Management Studio . Here is the script to create store procedure and table.  


Here is the script to create tables . I named it Student 


CREATE TABLE [dbo].[Student](
 [Student_Id] [int] IDENTITY(1,1) NOT NULL,
 [Name] [nvarchar](50) NULL,
 [Address] [nvarchar](100) NULL,
 [EmailID] [nvarchar](50) NULL,
 [Mobile] [varchar](10) NULL,
)

Here is the script to create store procedure . The first store procedure is to add new record into database  and i named it AddNewStudent.

CREATE PROCEDURE [dbo].[AddNewStudent]
 (  
@Name   nvarchar(20),
@Address nvarchar(60),
@EmailId  nvarchar(15), 
@Mobile   nvarchar(15) 
)
AS
insert into Student
(Name,  Address, EmailId, Mobile)
values
(@Name, @Address, @EmailId,@Mobile)
RETURN


Here is the procedure to update student records .

CREATE PROCEDURE [dbo].[UpdateStudent]
(
@Student_Id int,
@Name nvarchar(20),
@Address nvarchar(60),
@EmailID nvarchar(15), 
@Mobile nvarchar(15) 
)
AS
update Student
set 
Name = @Name, 
Address = @Address, 
EmailID = @EmailID, 
Mobile = @Mobile 
where Student_Id = @Student_Id
RETURN


Here is the script for delete student records .

CREATE PROCEDURE [dbo].[DeleteStudent]
(
@Student_Id int
AS
delete from Student where Student_Id = @Student_Id
RETURN

GO

No comments:

Post a Comment