Thursday 28 December 2017

Learn C language Part 22 Calculator using switch CASE And Function in c







#include <stdio.h>

#include <conio.h>



void plus(float a,float b);

void minus(float a,float b);

void multiply(float a,float b);

void divide(float a,float b);





main()

{



char c,d;

float x,y;



l1:

printf("------Press + for addition------");

printf("\n------Press - for Subtraction------");

printf("\n------Press * for Multiplication------");

printf("\n------Press / for Division------");



printf("\nSelect An Operation: ");

c=getchar();



printf("\nEnter 1st Number: ");

scanf("%f",&x);

printf("\nEnter 2nd Number: ");

scanf("%f",&y);





switch(c)

{



case '+':

plus(x,y);

break;





case '-':

minus(x,y);

break;





case '*':

multiply(x,y);

break;





case '/':

divide(x,y);

break;





default:

printf("\nInvalid Operation selected\n");

goto l1;

break;





}//switch scope end..............

l2:

printf("\n\n\n\nDo you want to continue....\n press (y/n)");

scanf(" %c",&d);

getchar();



if(d=='y'|| d=='Y')

{

printf("------------------------------------------------------------");



printf("\n\n\n\n");

printf("------------------------------------------------------------");



goto l1;



}

else if(d=='n'|| d=='N')



{

printf("Good bye......\n Press any key to exit!");

}



else

{

printf("Invalid Command !!!\n");

goto l2;

}



}//main function end..................................





void plus(float a,float b)

{

printf("%.2f",a+b);

}



void minus(float a,float b)

{

printf("%.2f",a-b);

}



void multiply(float a,float b)

{

printf("%.2f",a*b);

}

void divide(float a,float b)

{

printf("%.2f",a/b);

}












Learn C language Part 21 Introduction to Function, Difference b/w void ...







#include <stdio.h>

#include <conio.h>



int sum(int a,int b);



main()

{



int z,y,x;



printf("Enter the number: ");

scanf("%d",&x);

printf("Enter the 2nd number: ");

scanf("%d",&y);



z=sum(x,y);





printf("%d",z);





}

//main method end..............



int sum(int a,int b)

{

return a+b;

}

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

#include <stdio.h>
#include <conio.h>

void sum(int a,int b);

main()
{

int y,x;

printf("Enter the number: ");
scanf("%d",&x);
printf("Enter the 2nd number: ");
scanf("%d",&y);

sum(x,y);


//printf("%d",z);


}
//main method end..............

void sum(int a,int b)
{
printf("%d",a+b);
}


Tuesday 26 December 2017

Learn C language Part 20 Search Element in array in c language





#include <stdio.h>

#include <conio.h>



main()

{

int n,i,index=-1;

int x[6]{32,54,23,66,2,1};

printf("Enter the number that u want to search in array: ");

scanf("%d",&n);



for(i=0;i<6;i++)

{



if(x[i]==n)

{



index=i;

break;



}







} //loop end....



if(index==-1)

{

printf("%d doesnot exist in array",n );

}

else

{

printf("%d is found at %d position",n,index);

}



}

Learn C language Part 19 Two Dimenstional Array in C ,Sum and Differnce of Two Matrices

#include<stdio.h>
#include<conio.h>

main()
{

int r,c;
int a[3][3];
int b[3][3];
int d[3][3];
int e[3][3];

//matrices A................................

for(r=0;r<3;r++)
{


for(c=0;c<3;c++)
{
printf("Enter the number at A[%d,%d]: ",r,c);
scanf("%d",&a[r][c]);
}



} //outer loop



//matrices B................................

for(r=0;r<3;r++)
{


for(c=0;c<3;c++)
{
printf("Enter the number at B[%d,%d]: ",r,c);
scanf("%d",&b[r][c]);
}



} //outer loop


//sum of these matrices.............................


for(r=0;r<3;r++)
{


for(c=0;c<3;c++)
{
d[r][c]=a[r][c] +b[r][c];
}



} //outer loop


for(r=0;r<3;r++)
{


for(c=0;c<3;c++)
{
e[r][c]=a[r][c]-b[r][c];
}



} //outer loop





//printing the A.......................

printf("\n\n\nMatrices A: \n");


for(r=0;r<3;r++)
{

printf("|\t");
for(c=0;c<3;c++)
{
printf("%d\t",a[r][c]);
}

printf("|\n");



} //outer loop



//printing the A.......................

printf("\n\n\nMatrices B: \n");


for(r=0;r<3;r++)
{

printf("|\t");
for(c=0;c<3;c++)
{
printf("%d\t",b[r][c]);
}

printf("|\n");



} //outer loop









//printing the sum.......................



printf("\n\n\nMatrices D: (Sum of A & B)\n");



for(r=0;r<3;r++)
{

printf("|\t");
for(c=0;c<3;c++)
{
printf("%d\t",d[r][c]);
}

printf("|\n");



} //outer loop







//printing the sum.......................



printf("\n\n\nMatrices E: (Difference of A & B)\n");



for(r=0;r<3;r++)
{

printf("|\t");
for(c=0;c<3;c++)
{
printf("%d\t",e[r][c]);
}

printf("|\n");



} //outer loop







}

Learn C language Part 18 Two Dimenstional Array in C, MATRICES IN C

\



#include <stdio.h>

#include <conio.h>





main()

{

 textcolor(RED);

int  i,j;

int x[3][3];



for(i=0;i<3;i++)

{





for(j=0;j<3;j++)

{



printf("Enter the number that you want to save on position x[%d,%d] : ",i,j);

scanf("%d",&x[i][j]);



} //inner loop









} //outer loop





printf("\n\n\n");

//printing the matrices .........................................

printf("Matrices A\n");



for(i=0;i<3;i++)

{

printf("|\t");



for(j=0;j<3;j++)

{



printf("%d\t",x[i][j]);



} //inner loop

printf("|");



printf("\n\n");





} //outer loop





}

Learn C language Part 18 Two Dimenstional Array in C, MATRICES IN C

\



#include <stdio.h>

#include <conio.h>





main()

{

 textcolor(RED);

int  i,j;

int x[3][3];



for(i=0;i<3;i++)

{





for(j=0;j<3;j++)

{



printf("Enter the number that you want to save on position x[%d,%d] : ",i,j);

scanf("%d",&x[i][j]);



} //inner loop









} //outer loop





printf("\n\n\n");

//printing the matrices .........................................

printf("Matrices A\n");



for(i=0;i<3;i++)

{

printf("|\t");



for(j=0;j<3;j++)

{



printf("%d\t",x[i][j]);



} //inner loop

printf("|");



printf("\n\n");





} //outer loop





}

Learn C language Part 18 Two Dimenstional Array in C, MATRICES IN C

\



#include <stdio.h>

#include <conio.h>





main()

{

 textcolor(RED);

int  i,j;

int x[3][3];



for(i=0;i<3;i++)

{





for(j=0;j<3;j++)

{



printf("Enter the number that you want to save on position x[%d,%d] : ",i,j);

scanf("%d",&x[i][j]);



} //inner loop









} //outer loop





printf("\n\n\n");

//printing the matrices .........................................

printf("Matrices A\n");



for(i=0;i<3;i++)

{

printf("|\t");



for(j=0;j<3;j++)

{



printf("%d\t",x[i][j]);



} //inner loop

printf("|");



printf("\n\n");





} //outer loop





}

Thursday 21 December 2017

Learn C language Part 17 Sum of Arrays values





#include <stdio.h>

#include <conio.h>



main()

{



int x[6]; // array declaration......



x[0]=100;

x[1]=100;

x[2]=501;

x[3]=603;

x[4]=905;

x[5]=545;

int i,sum=0;







for(i=0;i<6;i++)

{



sum=sum+x[i];



}



printf("%d",sum);





}


Learn C language Part 16 Basic Introduction to Array





int x[5]; // array declaration......



x[0]=78;

x[1]=100;

x[2]=67;

x[3]=96;

x[4]=90;

printf("%d\n",x[4]);

Tuesday 19 December 2017

Learn C language Part 15 Print lower Trianlge pattern nested loop

#include <stdio.h>

#include <conio.h>



main()

{



int i=0,j=0;

for(i=0;i<10;i++)

{





for(j=0;j<=i;j++)

{



printf("x");



}

printf("\n");













}

//outer loop end...................



























}




Learn C language Part 14 Print Upper Trianlge pattern nested loop





#include <stdio.h>

#include <conio.h>



main()

{





int i=0,j=0;







for(i=0;i<5;i++)

{





for(j=i;j<5;j++)

{



printf("*");

}



printf("\n");







} //outer looop





























}




Learn C language Part 13 Print Square using nested loop





#include <stdio.h>

#include <conio.h>



main()

{





int i=0,j=0;







for(i=0;i<5;i++)

{





for(j=0;j<15;j++)

{



printf("*");

}



printf("\n");







} //outer looop





























}




Sunday 17 December 2017

Learn C language Part 11 Do while loop in C language




#include <stdio.h>
#include <conio.h>

main()
{

int x=1;

do
{
printf("salman");
x++;
}
while(x>1);

}

Learn C language Part 10 Factorial program using while loop in c





#include <stdio.h>

#include <conio.h>



main()

{



int fac=1,x=4;



printf("Enter the number: ");

scanf("%d",&x);



int y=x;

while(x>1)

{



fac=fac* x;



x--;

}



printf("%d ! = %d ",y,fac);



}


Learn C language Part 9 while loop in c





#include <stdio.h>

#include <conio.h>



main()

{



int x=0;



while(x<=10)

{



printf("salman %d\n",x);

x++;

}



printf("\nLoop break");







}

Thursday 14 December 2017

Learn C language Part 8 how to show Maths tables using for loop





#include <stdio.h>

#include <conio.h>



main()

{



int t,n,i;

printf("Enter the number which table you want to show: ");

scanf("%d",&t);



printf("Enter the limit of table: ");

scanf("%d",&n);







for(i=1;i<=n;i++)

{



printf("%d  x  %d = %d\n",t,i,t*i);





}







}


Learn C language Part 7 sum of natural n numbers & limit of a integer v...







#include <stdio.h>

#include <conio.h>



main()

{



 //1 -100

int i=0,n;

float x;

l1:
x=0;


printf("Enter the number: ");

scanf("%d",&n);



for(i=1;i<=n;i++)

{



x=x+i;



}



printf("sUM OF 100 = %.1f",x);

printf("\n\n\n");

printf("----------------------------------------------");



goto l1;





}


Learn C language Part 6 (How For Loop Works in all Programming languages)







#include <stdio.h>

#include <conio.h>



main()

{





int i=0;



for(i=1;i<=10;i++)

{

printf("salman%d\n",i);

}

printf("Loop break");







}


Wednesday 13 December 2017

Learn Sql server in hindi/urdu part-25 (many to many relationship)







create table tblstudent

(

st_id int primary key identity,

st_name nvarchar(20) not null

)

insert into tblstudent

values('Ali')

insert into tblstudent

values('Bilal')

insert into tblstudent

values('Zahid')

insert into tblstudent

values('Fahad')

insert into tblstudent

values('saleem')

insert into tblstudent

values('kamran')

select * from tblstudent



create table tblcourses

(

c_id int primary key identity,

c_title nvarchar(20) not null



)



insert into tblcourses

values('data structure')

insert into tblcourses

values('database&management')

insert into tblcourses

values('Data Audit')

insert into tblcourses

values('data warehosuing')

insert into tblcourses

values('data mining')

insert into tblcourses

values('data Analytics')



select* from tblcourses

select * from tblstudent







create table course_student

(

cs_id int primary key identity,

cs_fk_st int foreign key references tblstudent(st_id),

cs_fk_cu int foreign key references tblcourses(c_id),



)



insert into course_student

values(1,3)

insert into course_student

values(1,5)

insert into course_student

values(1,6)





insert into course_student

values(2,2)

insert into course_student

values(2,3)

insert into course_student

values(2,6)







insert into course_student

values(3,1)

insert into course_student

values(3,2)

insert into course_student

values(3,3)







select s.st_id,c.c_id,s.st_name,c.c_title from course_student cs inner join tblstudent s on s.st_id=cs.cs_fk_st inner join tblcourses c on c.c_id=cs.cs_fk_cu


Learn Sql server in hindi/urdu part-24 (one to many relationship with pr...







create table customer

(

c_id int identity primary key,

c_name nvarchar(20) not null

)



insert into customer

values('asim')

insert into customer

values('basit')

insert into customer

values('danish')

insert into customer

values('Ebad')



select * from customer



create table product

(

p_id int identity primary key,

p_name nvarchar(20) not null



)



select * from product







create table tblorder

(

o_id int identity primary key,

o_product_id int foreign key references product(p_id),

o_date datetime,

o_c_id int foreign key references customer(c_id),

)





insert into tblorder

values(3,GETDATE(),4)





select c.c_id,c.c_name,p.p_name,o.o_id,o.o_date from tblorder o inner join product p on p.p_id=o.o_product_id inner join customer c on c.c_id=o.o_c_id








Tuesday 12 December 2017

Learn C language Part 5 goto unconditional jump stattements with marksheet program

#include<stdio.h>
#include<conio.h>

main()
{

int eng,math,phy,urdu,islamiat;
float percentage;
l1:
printf("Enter the marks obtained in English: ");
scanf("%d",&eng);

if(eng<0)
{
printf("\nInvalid input !obtained Marks cannot be negative\n\n");
goto l1;
}


l2:
printf("\nEnter the marks obtained in Mathematics: ");
scanf("%d",&math);


if(math<0)
{
printf("\nInvalid input !obtained Marks cannot be negative\n\n");
goto l2;
}



l3:
printf("\nEnter the marks obtained in Physics: ");
scanf("%d",&phy);
if(phy<0)
{
printf("\nInvalid input !obtained Marks cannot be negative\n\n");
goto l3;
}



l4:

printf("\nEnter the marks obtained in Urdu: ");
scanf("%d",&urdu);

if(urdu<0)
{
printf("\nInvalid input !obtained Marks cannot be negative\n\n");
goto l4;
}




l5:
printf("\nEnter the marks obtained in Islamiat: ");
scanf("%d",&islamiat);
if(islamiat<0)
{
printf("\nInvalid input !obtained Marks cannot be negative\n\n");
goto l5;
}





percentage= ((eng+math+phy+urdu+islamiat)*100/500);

printf("Percentage: %.2f",percentage);

printf("\n\n\n Grade:");
if(percentage>=80)
{
printf("A+");

}
else if(percentage>=70)
{
printf("A");
}
else if(percentage>=60)
{
printf("B");
}
else if(percentage>=50)
{
printf("C");
}
else
{
printf("F");

}





}

Learn C language Part -4 if else ,ladder if else, nested if else statements with practical example

#include <stdio.h>
#include <conio.h>

main()
{

int age;

printf("Enter your age: ");
scanf("%d",&age);

if(age>=18)
{
// printf("YOU ARE ELIGIBLE FOR THIS JOB......");
if(age<=20)
{
printf("YOU ARE ELIGIBLE FOR clerk JOB......");
}

else if(age<=25)
{

printf("YOU ARE ELIGIBLE FOR HR JOB......");
}

else if(age<=30)
{

printf("YOU ARE ELIGIBLE FOR manager JOB......");
}
else
{
printf("age limit exceeded!......");
}


}


else
{
printf("YOU ARE NOT ELIGIBLE FOR THIS JOB......");
}







}

Monday 11 December 2017

Learn Sql server in hindi/urdu part-23(one to one relationship)





create table car

(

car_id int identity primary key,

car_name nvarchar(20) not null,

car_model nvarchar(10) not null,



)



insert into car

values('Mehran','1980')



select * from car



create table employee

(

emp_id int identity primary key,

emp_name nvarchar(20) not null,

emp_desig nvarchar(20) not null,

emp_car_fk int unique foreign  key references car(car_id)



)











insert into employee

values('ahmed','officer',2)





select  e.emp_id,e.emp_name,e.emp_desig,c.car_id,c.car_model,c.car_name from employee e inner join car c on c.car_id=emp_car_fk


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


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

Monday 4 December 2017

Learn Sql server in hindi/urdu part-18(Updateable Views IN SQL SERVER)





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)

Insert into tblEmployee values (4,'Todd', 4800, 'Male', 4)

Insert into tblEmployee values (5,'Sara', 3200, 'Female', 1)

Insert into tblEmployee values (6,'Ben', 4800, 'Male', 3)









Create view vWEmployeesDataExceptSalary

as

Select Id, Name, Gender, DepartmentId

from tblEmployee





Select * from vWEmployeesDataExceptSalary

select * from tblEmployee





Update vWEmployeesDataExceptSalary



Set Name = 'salman' Where Id = 2





Update vWEmployeesDataExceptSalary

set salary=20000 where id=2




Learn Sql server in hindi/urdu part-17(Views/virtual table IN SQL SERVER)

--What is a View?
--A view is nothing more than a saved SQL query. A view can also be considered as a virtual table.


CREATE TABLE tblEmployee
(
  Id int Primary Key,
  Name nvarchar(30),
  Salary int,
  Gender nvarchar(10),
  DepartmentId int
)
CREATE TABLE tblDepartment
(
 DeptId int Primary Key,
 DeptName nvarchar(20)
)

Insert into tblDepartment values (1,'IT')
Insert into tblDepartment values (2,'Payroll')
Insert into tblDepartment values (3,'HR')
Insert into tblDepartment values (4,'Admin')


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)
Insert into tblEmployee values (4,'Todd', 4800, 'Male', 4)
Insert into tblEmployee values (5,'Sara', 3200, 'Female', 1)
Insert into tblEmployee values (6,'Ben', 4800, 'Male', 3)
Insert into tblEmployee values (7,'salman',51800, 'Male', 4)



select * from tblDepartment
select * from tblEmployee


create view viewforall
as
select * from tblEmployee


select * from viewforall

create view viewforreception
as
select id,Name,Gender,DepartmentId from tblEmployee

select * from viewforreception



create view viewforrecpetionwithdeptname
as

select e.Id,e.Name,e.Gender,d.DeptName from tblEmployee e inner join tblDepartment d on d.DeptId=e.DepartmentId


select * from viewforrecpetionwithdeptname



Create View vWEmployeesCountByDepartment
as
Select DeptName, COUNT(Id) as TotalEmployees
from tblEmployee
join tblDepartment
on tblEmployee.DepartmentId = tblDepartment.DeptId
Group By DeptName


select * from tblDepartment
select * from tblEmployee


select * from vWEmployeesCountByDepartment

Friday 1 December 2017

Learn Sql server in hindi/urdu part-16(String fucntions-2 IN SQL SERVER)





Select LTRIM('      Hello')





Select RTRIM (LTRIM('  Hello   '))



Select LOWER('CONVERT This String Into Lower Case')

Select UPPER('CONVERT This String Into Lower Case')

Select REVERSE('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

Select LEN('ABCDEFGHIJKLMNOPQRSTUVWXYZ')


Learn Sql server in hindi/urdu part-15(String fucntions IN SQL SERVER)





use stringfunction





print ASCII('A')

print CHAR(51)









declare @number int

set @number=65

while(@number<=90)

begin



print CHAR(@number)



set @number=@number+1

end


Learn Sql server in hindi/urdu part-15(String fucntions IN SQL SERVER)





use stringfunction





print ASCII('A')

print CHAR(51)









declare @number int

set @number=65

while(@number<=90)

begin



print CHAR(@number)



set @number=@number+1

end


Monday 27 November 2017

Learn Sql server in hindi/urdu part-14(Union and Union All)







--The UNION operator is used to combine the result-set of two or more SELECT statements.



--Each SELECT statement within UNION must have the same number of columns

--The columns must also have similar data types

--The columns in each SELECT statement must also be in the same order





create table tblIndiaCustomers

(

id int identity,

Name nvarchar(20),

email nvarchar(20)

)

create table tblUKCustomers

(

id int identity,

Name nvarchar(20),

email nvarchar(20)

)





insert into tblIndiaCustomers

values('Aditi','Aditi@yahoo.com')



insert into tblIndiaCustomers

values('Rahul','Rahul@yahoo.com')



insert into tblIndiaCustomers

values('Sundar','Sundar@yahoo.com')



insert into tblIndiaCustomers

values('Ganesh','Ganesh@yahoo.com')





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



insert into tblUKCustomers

values('Mark','Mark@hotmail.com')



insert into tblUKCustomers

values('Ben','Ben@hotmail.com')



insert into tblUKCustomers

values('Linda','Linda@hotmail.com')



insert into tblUKCustomers

values('Suzan','Suzan@hotmail.com')



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





select * from tblIndiaCustomers

union

select * from tblUKCustomers





select * from tblIndiaCustomers

union all

select * from tblUKCustomers










Learn Sql server in hindi/urdu part-13 (Delete and Update using Store Pr...











create proc delete_employee

(

@emp_id int



)



as

begin



delete from employee where emp_id=@emp_id





end









execute delete_employee 3011













create proc  update_employee

(

@emp_id int,

@emp_salary int,

@emp_address nvarchar(100),

@emp_dept_id int



)

as

begin



update employee

set emp_salary=@emp_salary , emp_address=@emp_address ,dem_deptid=@emp_dept_id where emp_id=@emp_id





end



select * from employee





execute update_employee 2003,40000,'R-32 sector sec-11',2



Wednesday 22 November 2017

Learn Sql server in hindi/urdu part-11(Group by in Sql server)







select  count(emp_id),emp_salary from employee group by emp_salary



select count(e.emp_id) as 'Total Employees', d.dept_name from employee e inner join department d on d.dept_id=e.dem_deptid

group by d.dept_name having  count(e.emp_id) >3

Tuesday 21 November 2017

Snake Ladder Game in windows Form C# (PART-1)





Load event:
pictureBox3.Image
=
Image.FromFile(@"C:\Users\salman\Documents\Visual Studio
2013\Projects\WindowsFormsApplication3\WindowsFormsApplication3\Resources\roll.png"
);
           pictureBox3.SizeMode = PictureBoxSizeMode.StretchImage;

roll dice button:
label2.Text = logics.rolldice(pictureBox3).ToString();

class:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
    class logics
    {


        public static int rolldice(PictureBox px)
        {

            int dice = 0;
            Random r = new Random();
            dice = r.Next(1, 7);
            px.Image = Image.FromFile(@"C:\Users\salman\Documents\Visual Studio
2013\Projects\WindowsFormsApplication3\WindowsFormsApplication3\Resources\"
+ dice + ".png");
            px.SizeMode = PictureBoxSizeMode.StretchImage;

            return dice;
       
       
        } //roll dice
method end................



    }
}



Friday 17 November 2017

Learn Sql server in hindi/urdu part-10 (Like and WildCards in sql Server)





select  *from employee



  insert into employee values('Abid',15000,1)





  select * from employee where emp_name like 'A%'



  select * from employee where emp_name like '%a'



  select * from employee where emp_name like '%a%n'



  select * from employee where emp_name like '__n%'



  select * from employee where emp_name like  's_%'



  select * from employee where emp_name like  's%a'


Learn Sql server in hindi/urdu part-9 (Sum ,Top and Subquery on differen...





 select * from employee

  select * from department





  --display top 3 records from employee table.

  select top 2 * from employee  where emp_id < (select max(emp_id) from employee)  order by emp_salary desc





  select * from employee order by emp_salary asc





  --dispaly sum of salary of those employees who are working in Marketing department



  select sum(emp_salary) from employee e inner join department d on d.dept_id=e.dem_deptid

  where d.dept_name='Marketing'







  --display top 5 records of employees  who are working in Hr and Marketing

  select top 5 * from employee e inner join department d on d.dept_id=e.dem_deptid

  where d.dept_name='Marketing' or d.dept_name='Hr'


Learn Sql server in hindi/urdu part-8 Aggregate function with inner joi...





use sql1707b1





select * from sys.tables



select * from employee

select * from department





--display maximum salary from employee table

select max(emp_salary)from employee





--display minimum salary from employee table

select min(emp_salary) from employee





--display avg salary from employee table



select avg(emp_salary) from employee





--display no.of employees record from employee table

select count(emp_id) from employee







--display, how many employees are working in Hr Department with salary >10000



 select count(e.emp_id) from employee e inner join

  department d on d.dept_id=e.dem_deptid where e.emp_salary>10000 and d.dept_name='HR'



;


Thursday 16 November 2017

Learn Sql server in hindi/urdu part-7 (Left & right Join in Sql Server)





create table department

(

dept_id int identity primary key,

dept_name nvarchar(20) not null,

)



select * from department





insert into department

values('Hr')



insert into department

values('Admin')



insert into department

values('Marketing')



insert into department

values('Faculty')



insert into department

values('Managers')







create table employee

(

emp_id int identity primary key,

emp_name nvarchar(20) not null,

emp_salary int,

dem_deptid int foreign key references department(dept_id)



)





insert into employee

values('Ali',40000,3)



insert into employee

values('Ali',30000,1)



insert into employee

values('sami',50000,2)



insert into employee

values('sana',20000,2)



insert into employee

values('kamran',70000,4)



insert into employee

values('sumaira',10000,1)





insert into employee

values('moosa',10000,10)





select * from employee

select * from department





select e.emp_id,e.emp_name,e.emp_salary,d.dept_name,d.dept_id,e.dem_deptid from

employee e inner join department d on d.dept_id=e.dem_deptid







select * from department d inner join employee e on d.dept_id=e.dem_deptid



select * from department d left join employee e on d.dept_id=e.dem_deptid





select * from employee e right join department d on d.dept_id=e.dem_deptid








Learn Sql server in hindi/urdu part-6 (Inner Join in Sql Server)





create table department

(

dept_id int identity primary key,

dept_name nvarchar(20) not null,

)



select * from department





insert into department

values('Hr')



insert into department

values('Admin')



insert into department

values('Marketing')



insert into department

values('Faculty')



insert into department

values('Managers')







create table employee

(

emp_id int identity primary key,

emp_name nvarchar(20) not null,

emp_salary int,

dem_deptid int foreign key references department(dept_id)



)





insert into employee

values('Ali',40000,3)



insert into employee

values('Ali',30000,1)



insert into employee

values('sami',50000,2)



insert into employee

values('sana',20000,2)



insert into employee

values('kamran',70000,4)



insert into employee

values('sumaira',10000,1)





insert into employee

values('moosa',10000,10)





select * from employee

select * from department





select e.emp_id,e.emp_name,e.emp_salary,d.dept_name,d.dept_id,e.dem_deptid from

employee e inner join department d on d.dept_id=e.dem_deptid







select * from department d inner join employee e on d.dept_id=e.dem_deptid


Tuesday 14 November 2017

5- Variables in JavaScript (Diffrence b/w strongly type and loosely type...





<!DOCTYPE
html>
<html>
<body>
  <h1>Demo: JavaScript Variables
</h1>
 
  <p id="p1"></p>
  <script>
  var
one =1;  // number value
  one= 1.1; // 
decimal value
 
  one = true; // Boolean value
 
  one = null; // null value
 
  one = 'one'; // string value
  document.getElementById("p1").innerHTML
= one;
    </script>
</body>


</html>

Monday 13 November 2017

Learn Sql server in hindi/urdu part-4 (Alter Table ,Update Table and Whi...





alter table student



add dateofadmission date





select * from student



update student

set dateofadmission='11/14/2016'

where id in (2,4)







Declare @Number int



Set @Number = 1008

While(@Number <= 1010)

Begin



 update student

set dateofadmission='11/11/2016'

where id =@Number





 Set @Number = @Number + 1





End







insert into student(name,batchcode,contactnumber,dateofadmission)

values('xyz','14b2v1','090078601',GETDATE())





select * from student




Learn Sql server in hindi/urdu part-4 (Not Operator and Order By Clause)





select * from student --display all data



select  id,name,contactnumber from student --display selected column



select * from student where batchcode='1208c1' -- where clause with one column



select * from student where name='emad' and batchcode='1708c1' and id=1003 --where clause with and operator



select * from student where batchcode='1708c1' or batchcode='120c1'



select * from student order by name  desc



select * from student order by name  asc



select * from student order by id desc



select * from student where batchcode!='1707b1' and batchcode!='1610c1'





select * from student where batchcode!='1707b1' or batchcode!='1610c1'





select * from student where batchcode not in ('1707b1','1610c1','1502c1')



select * from student where id not in (1002,1003,1004,2,4)


Friday 10 November 2017

Learn Sql server in hindi/urdu part-2 (Constraints ,not null ,unique, id...







create database sql1707b1



use sql1707b1







create table student

(



id int primary key identity,

name nvarchar(20) not null,

batchcode nvarchar(20) not null,

contactnumber nvarchar(20) not null unique



)









insert into student (name,batchcode,contactnumber)

values('safeer','1707b1','03425321680')





insert into student (name,batchcode,contactnumber)

values('naseer','1707b1','03415321680')







delete from student --deleting record..........

drop table student





select * from student





select * from student where id=1


Learn Sql server in hindi part-1 (create database,use database,create ta...











create database sql1707b1



use sql1707b1







create table student

(

id int,

name nvarchar(20),

batchcode nvarchar(20),

contactnumber nvarchar(20)



)



select * from student



insert into student (id,name,batchcode,contactnumber)

values(1,'sahil','1707b1','03425321680')



insert into student (id,name,batchcode,contactnumber)

values(2,'Hammad','1707b1','03424323680')



insert into student (id,name,batchcode,contactnumber)

values(3,'AbuZar','1707b1','03413325581')




Saturday 28 October 2017

Anonymous method in C# Complete Guide from basic

example -1

 class Program
    {
        public delegate void Print(int value);
        static void Main(string[] args)
        {
            Print print = delegate(int val)
            {
                Console.WriteLine("Inside Anonymous method. Value: {0}", val);
            };

            print(100);
            print(2000);

            Console.ReadLine();
        }




    }

example -2

 class Program
    {
        public delegate void Print(int value);
        static void Main(string[] args)
        {
            int i = 10;

            Print prnt = delegate(int val)
            {
               // val += i;
                val = val + i;
                Console.WriteLine("Anonymous method: {0}", val);
            };

            prnt(100);

            Console.ReadLine();
        }
    }

example -3


  class Program
    {
        public delegate void Print(int value);
   
        static void Main(string[] args)
        {
            PrintHelperMethod(delegate(int val) 
            {
                Console.WriteLine("Anonymous method: {0}", val); 
            }, 100);

            Console.ReadLine();


        }

        public static void PrintHelperMethod(Print printDel, int val)
        {
            val += 10;
            printDel(val);
        }
    }

Friday 27 October 2017

From Validation in JavaScript with html and Css Complete Tutorial From Basic

Html code:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Form Validation</title>

<link href="css/style.css" rel="stylesheet" type="text/css"/>
</head>

<body>
<div id="wrapper"> 




<div id="formbox">

<table> 


<tr>  <td style="width:30px">Email </td>   <td> <input type="text" id="email" onChange="checkemail()" style="border-radius:20px 20px 20px 20px;height:35px;width:200px"/> </td>  <td> <span id="emailerror"> </span>  </td>  </tr>


<tr>  <td>Password </td>   <td> <input type="password"  id="pwd" onChange="checkPASSWORDLENGTH()" style="border-radius:20px 20px 20px 20px;height:35px;width:200px"/> </td>  <td> <span id="pwderror"> </span>  </td>  </tr>



<tr>  <td>Confirm Password </td>   <td> <input type="password" id="cpwd" onChange="confrimpassword()"  style="border-radius:20px 20px 20px 20px;height:35px;width:200px"/> </td>  <td> <span id="cpwderror"> </span>  </td>  </tr>

<tr>   
 <td>


 </td> 
 <td>
<button> Submit!</button>

 </td> 
 
 
  </tr>



</table>


 </div>






</div>

<script src="js/js.js"> </script>


</body>
</html>

css code:

@charset "utf-8";
/* CSS Document */
body
{ margin:0 auto;
padding:0px;

}

#wrapper
{ width:100%;
height:1000px;
background-image:url(../img/login.jpg);
background-size:100% 1000px;

}
#formbox
{ width:500px;
height:300px;
background-color:rgba(243, 242, 242,0.4); 
position:absolute;
 margin-left:300px;
 margin-top:300px; 



}
td
{ padding:15px;
}

Js code:

// JavaScript Document

function checkemail()
{
var c=document.getElementById("email").value;
var pos=c.search("@");
if(pos==-1)
{
document.getElementById("emailerror").innerHTML="Invalid Email Id";
document.getElementById("emailerror").style.color="red";
}
else
{
var domainname=c.substring(pos+1); 

var d= domainname.toLowerCase();

if(d!=="yahoo.com")
{
document.getElementById("emailerror").innerHTML="use correct domain name like yahoo.com";
document.getElementById("emailerror").style.color="red";

}
else
{
document.getElementById("emailerror").innerHTML="valid Email Id";
document.getElementById("emailerror").style.color="green";
}


}



}







function checkPASSWORDLENGTH()
{
var c=document.getElementById("pwd").value;
var l=c.length;
if(l<8 || l>15)
{
document.getElementById("pwderror").innerHTML="Password should contain atleast 8 characters!";
document.getElementById("pwderror").style.color="red";
}

else
{
document.getElementById("pwderror").innerHTML="valid Password ";
document.getElementById("pwderror").style.color="green";
}
}







function confrimpassword()
{

var pwd=document.getElementById("pwd").value;
var cpwd=document.getElementById("cpwd").value;

if(pwd!==cpwd)
{
document.getElementById("cpwderror").innerHTML="Password Mismatch";
document.getElementById("cpwderror").style.color="red";
}
else
{
document.getElementById("cpwderror").innerHTML="Password match";
document.getElementById("cpwderror").style.color="green";

}


}


image and jumbotron class in bootstrap





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>grid in bs</title>

<link type="text/css" rel="stylesheet" href="css/bootstrap.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap.min.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap-theme.css"/>

<link type="text/css" rel="stylesheet" href="css/bootstrap-theme.min.css"/>



<style>



body

{ background-color:#000;

 

}



#SIDE a:hover

{ background-color:#09F;

color:#fff;

font-family:"Courier New", Courier, monospace;

font-size:26px;



}



</style>



</head>



<body>



<div class="container" style="height:1000px; background-color:#069">



<div class="row" style="height:200px; background-color:#096;background-image:url(img/1.jpg); background-size:100% 1000px">



<div class="col-sm-4" style="height:200px; ">



<img src="img/logo (1).png" style="width:80%;height:200px"/>

 </div>



<div class="col-sm-4" style="height:200px; "> </div>



<div class="col-sm-4" style="height:200px; ">



</div>





</div>



<!-- HEad section end..............................................  -->

<div class="row" style="height:50px; background-color:#036">









</div>





<DIV class="row" style=" height:1000px; background-color:#CCC">



<div ID="SIDE" style="height:1000px;background-image:url(img/1.jpg); background-size:100% 1000px" class="col-sm-2">



<h3>ASIDE BAR </h3>







<nav>



<ul class="nav  nav-pills  nav-stacked">



<li class="active"> <a href="#" >Home </a> </li>





<li> <a href="#">About Us </a> </li>





<li> <a href="#">Gallery </a> </li>





<li> <a href="#">Contact Us </a> </li>





<li> <a href="#">Admission </a> </li>





<li> <a href="#">Home </a> </li>





<li> <a href="#">About Us </a> </li>





<li> <a href="#">Gallery </a> </li>





<li> <a href="#">Contact Us </a> </li>





<li> <a href="#">Admission </a> </li>











</ul>



</nav>











</div>



<div style="background-color:white;height:1000px;background-image:url(img/2.jpg); background-size:100% 1000px" class="col-sm-8">





<div style="width:100%; background-color:rgba(82, 99, 158,0.4)">

<div class="jumbotron" >



<h1>Bootstrap Tutorial </h1>



<p>Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web. </p>



</div>



</div>



<table style="margin-left:90px">



<tr>

<td>

<img src="img/slide1.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>



<td>

<img src="img/slide2.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>

 

 

 <td>

<img src="img/slide3.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>

 

 



 </tr>



 <tr>

<td>

<img src="img/slide2.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>



<td>

<img src="img/slide3.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>

 

 

 <td>

<img src="img/slide1.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>

 

 



 </tr>





 <tr>

<td>

<img src="img/slide1.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>



<td>

<img src="img/slide2.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>

 

 

 <td>

<img src="img/slide3.jpg" style="width:150px; height:100px; display:inline" class="img-responsive img-circle" />



 </td>

 

 



 </tr>













</table>







</div>





<div style="background-color:#C03;height:1000px; background-image:url(img/1.jpg); background-size:100% 1000px" class="col-sm-2"> </div>











</DIV>



























</div>



<!--  CONTAINER end..............................................  -->



























<script src="js/bootstrap.js"> </script>

<script src="js/bootstrap.min.js"> </script>

<script src="js/jquery.js"> </script>

<script src="js/jquery-migrate-1.4.1.min.js"> </script>





</body>



</html>

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 ...