Sunday, 10 December 2017

Learn C language Part 3 swapping the values of two variables







#include <stdio.h>

#include <conio.h>





main()

{



int x,y,z;



printf("Enter the value of x: ");

scanf("%d",&x); //5



printf("Enter the value of y: ");

scanf("%d",&y);//10



z=x; //z=5

x=y; //x=10

y=z; //y=5







printf("\n\n\n\nx=%d",x);

printf("\ny=%d",y);









}

Learn C language Part 3 swapping the values of two variables







#include <stdio.h>

#include <conio.h>





main()

{



int x,y,z;



printf("Enter the value of x: ");

scanf("%d",&x); //5



printf("Enter the value of y: ");

scanf("%d",&y);//10



z=x; //z=5

x=y; //x=10

y=z; //y=5







printf("\n\n\n\nx=%d",x);

printf("\ny=%d",y);









}

Learn C language Part 3 swapping the values of two variables







#include <stdio.h>

#include <conio.h>





main()

{



int x,y,z;



printf("Enter the value of x: ");

scanf("%d",&x); //5



printf("Enter the value of y: ");

scanf("%d",&y);//10



z=x; //z=5

x=y; //x=10

y=z; //y=5







printf("\n\n\n\nx=%d",x);

printf("\ny=%d",y);









}

Learn C language Part 2 scanf command, sum of two integer numbers





#include<stdio.h>

#include<conio.h>



main()

{



int x,y;

int z;



printf("Enter the value of x :");

scanf("%d",&x);



printf("Enter the value of y :");

scanf("%d",&y);



z=x+y;



printf("value of z = %d",z);











}

Learn C language Part 2 scanf command, sum of two integer numbers





#include<stdio.h>

#include<conio.h>



main()

{



int x,y;

int z;



printf("Enter the value of x :");

scanf("%d",&x);



printf("Enter the value of y :");

scanf("%d",&y);



z=x+y;



printf("value of z = %d",z);











}

Learn C language in very easy manner ( Part 1 Printf command)







#include<stdio.h>

#include<conio.h>



main()

{



printf("Hello world\nHello salman");







}


Wednesday, 6 December 2017

Learn Sql server in hindi/urdu part-20(Triggers IN SQL SERVER)

select * from sys.tables


-----------------------------------------------------------------------------
CREATE TABLE tblEmployee
(
  Id int Primary Key,
  Name nvarchar(30),
  Salary int,
  Gender nvarchar(10),
  DepartmentId int
)


Insert into tblEmployee values (1,'John', 5000, 'Male', 3)
Insert into tblEmployee values (2,'Mike', 3400, 'Male', 2)
Insert into tblEmployee values (3,'Pam', 6000, 'Female', 1)
----------------------------------------------------------------------------------------------

CREATE TABLE tblEmployeeAudit
(
  Id int identity(1,1) primary key,
  AuditData nvarchar(1000)
)
--------------------------------------------------------------------------------------------
CREATE TRIGGER tr_tblEMployee_ForInsert
ON tblEmployee
FOR INSERT
AS
BEGIN
 Declare @Id int
 Select @Id = Id from inserted

 insert into tblEmployeeAudit
 values('New employee with Id  = ' + Cast(@Id as nvarchar(5)) + ' is added at ' + cast(Getdate() as nvarchar(20)))
END
-------------------------------------------------------------------------------------------------------------
CREATE TRIGGER tr_tblEMployee_ForDelete
ON tblEmployee
FOR DELETE
AS
BEGIN
 Declare @Id int
 Select @Id = Id from deleted

 insert into tblEmployeeAudit
 values('An existing employee with Id  = ' + Cast(@Id as nvarchar(5)) + ' is deleted at ' + Cast(Getdate() as nvarchar(20)))
END



-------------------------------------------------------------------------------------------------------------


Create trigger tr_tblEmployee_ForUpdate2
on tblEmployee
for Update
as
Begin


 Declare @Id int
 Select @Id = Id from inserted


 insert into tblEmployeeAudit
 values('An existing employee with Id  = ' + Cast(@Id as nvarchar(5)) + ' is updated at ' + Cast(Getdate() as nvarchar(20)))

 Select * from deleted
 Select * from inserted


End


-------------------------------------------------------------------------------------------------------------

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...