Sunday, 3 June 2018

Finally block in Exception handling in C#



using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;



namespace ConsoleApplication36

{

    class Program

    {

        static void Main(string[] args)

        {



            int a, b;

            float c;

         

            l1:

            Console.WriteLine("Enter the value of a :");

            a = int.Parse(Console.ReadLine());



            Console.WriteLine("Enter the value of b :");

            b = int.Parse(Console.ReadLine());



            try

            {

                c =(float) (a *1.0 / b);

                Console.WriteLine("value of c =" + c);

            }

            catch (Exception e)

            {

                Console.ForegroundColor = System.ConsoleColor.Red;



                Console.WriteLine("Error is "+e);

            }



            finally

            {

                Console.ForegroundColor = System.ConsoleColor.White;

                Console.WriteLine("press any key to continue.....");

                Console.ReadKey();

                Console.Clear();

             

            }



            goto l1;



       

        }

    }

}


Saturday, 2 June 2018

Workshop Management system part 1





USE [master]

GO

/****** Object:  Database [workshops]    Script Date: 6/2/2018 3:59:50 PM ******/

CREATE DATABASE [workshops]

 CONTAINMENT = NONE

 ON  PRIMARY

( NAME = N'workshops', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\workshops.mdf' , SIZE = 3136KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )

 LOG ON

( NAME = N'workshops_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\workshops_log.ldf' , SIZE = 784KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)

GO

ALTER DATABASE [workshops] SET COMPATIBILITY_LEVEL = 110

GO

IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))

begin

EXEC [workshops].[dbo].[sp_fulltext_database] @action = 'enable'

end

GO

ALTER DATABASE [workshops] SET ANSI_NULL_DEFAULT OFF

GO

ALTER DATABASE [workshops] SET ANSI_NULLS OFF

GO

ALTER DATABASE [workshops] SET ANSI_PADDING OFF

GO

ALTER DATABASE [workshops] SET ANSI_WARNINGS OFF

GO

ALTER DATABASE [workshops] SET ARITHABORT OFF

GO

ALTER DATABASE [workshops] SET AUTO_CLOSE OFF

GO

ALTER DATABASE [workshops] SET AUTO_CREATE_STATISTICS ON

GO

ALTER DATABASE [workshops] SET AUTO_SHRINK OFF

GO

ALTER DATABASE [workshops] SET AUTO_UPDATE_STATISTICS ON

GO

ALTER DATABASE [workshops] SET CURSOR_CLOSE_ON_COMMIT OFF

GO

ALTER DATABASE [workshops] SET CURSOR_DEFAULT  GLOBAL

GO

ALTER DATABASE [workshops] SET CONCAT_NULL_YIELDS_NULL OFF

GO

ALTER DATABASE [workshops] SET NUMERIC_ROUNDABORT OFF

GO

ALTER DATABASE [workshops] SET QUOTED_IDENTIFIER OFF

GO

ALTER DATABASE [workshops] SET RECURSIVE_TRIGGERS OFF

GO

ALTER DATABASE [workshops] SET  ENABLE_BROKER

GO

ALTER DATABASE [workshops] SET AUTO_UPDATE_STATISTICS_ASYNC OFF

GO

ALTER DATABASE [workshops] SET DATE_CORRELATION_OPTIMIZATION OFF

GO

ALTER DATABASE [workshops] SET TRUSTWORTHY OFF

GO

ALTER DATABASE [workshops] SET ALLOW_SNAPSHOT_ISOLATION OFF

GO

ALTER DATABASE [workshops] SET PARAMETERIZATION SIMPLE

GO

ALTER DATABASE [workshops] SET READ_COMMITTED_SNAPSHOT OFF

GO

ALTER DATABASE [workshops] SET HONOR_BROKER_PRIORITY OFF

GO

ALTER DATABASE [workshops] SET RECOVERY FULL

GO

ALTER DATABASE [workshops] SET  MULTI_USER

GO

ALTER DATABASE [workshops] SET PAGE_VERIFY CHECKSUM 

GO

ALTER DATABASE [workshops] SET DB_CHAINING OFF

GO

ALTER DATABASE [workshops] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )

GO

ALTER DATABASE [workshops] SET TARGET_RECOVERY_TIME = 0 SECONDS

GO

USE [workshops]

GO

/****** Object:  StoredProcedure [dbo].[sp_insert_instructor]    Script Date: 6/2/2018 3:59:50 PM ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

create proc [dbo].[sp_insert_instructor]

(



@i_name nvarchar(20)  ,

@i_designation  nvarchar(20)  ,

@i_image nvarchar(max)



)

as

begin



insert into  tbl_instructor

values(@i_name   ,

@i_designation   ,

@i_image 

)

end

GO

/****** Object:  Table [dbo].[Employee]    Script Date: 6/2/2018 3:59:50 PM ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_PADDING ON

GO

CREATE TABLE [dbo].[Employee](

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

[Name] [varchar](20) NULL,

[Salary] [float] NULL,

[Department] [varchar](20) NULL

) ON [PRIMARY]



GO

SET ANSI_PADDING OFF

GO

/****** Object:  Table [dbo].[tbl_batch]    Script Date: 6/2/2018 3:59:50 PM ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[tbl_batch](

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

[b_name] [nvarchar](20) NOT NULL,

PRIMARY KEY CLUSTERED

(

[b_id] ASC

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

UNIQUE NONCLUSTERED

(

[b_name] 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

/****** Object:  Table [dbo].[tbl_feedbackform]    Script Date: 6/2/2018 3:59:50 PM ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[tbl_feedbackform](

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

[f_comment] [nvarchar](max) NOT NULL,

[f_marks] [int] NULL,

[f_wr_id_fk] [int] NULL,

[wr_id_fk_s] [int] NULL,

PRIMARY KEY CLUSTERED

(

[f_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] TEXTIMAGE_ON [PRIMARY]



GO

/****** Object:  Table [dbo].[tbl_instructor]    Script Date: 6/2/2018 3:59:50 PM ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[tbl_instructor](

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

[i_name] [nvarchar](20) NOT NULL,

[i_designation] [nvarchar](20) NOT NULL,

[i_image] [nvarchar](max) NOT NULL,

PRIMARY KEY CLUSTERED

(

[i_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] TEXTIMAGE_ON [PRIMARY]



GO

/****** Object:  Table [dbo].[tbl_student]    Script Date: 6/2/2018 3:59:50 PM ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[tbl_student](

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

[s_name] [nvarchar](20) NOT NULL,

[s_enrollment] [nvarchar](20) NOT NULL,

[s_image] [nvarchar](max) NOT NULL,

[s_batchcode] [int] NULL,

PRIMARY KEY CLUSTERED

(

[s_id] ASC

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

UNIQUE NONCLUSTERED

(

[s_enrollment] ASC

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

) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]



GO

/****** Object:  Table [dbo].[tbl_workshopname]    Script Date: 6/2/2018 3:59:50 PM ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[tbl_workshopname](

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

[w_name] [nvarchar](20) NOT NULL,

PRIMARY KEY CLUSTERED

(

[w_id] ASC

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

UNIQUE NONCLUSTERED

(

[w_name] 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

/****** Object:  Table [dbo].[tbl_workshoprecord]    Script Date: 6/2/2018 3:59:50 PM ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[tbl_workshoprecord](

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

[wr_date] [date] NULL,

[wr_id_fk_w] [int] NULL,

[wr_id_fk_i] [int] NULL,

PRIMARY KEY CLUSTERED

(

[wr_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]



GO

/****** Object:  Table [dbo].[tbl_workshoprecordforstudent]    Script Date: 6/2/2018 3:59:50 PM ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[tbl_workshoprecordforstudent](

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

[wr_date] [date] NULL,

[wr_id_fk_w] [int] NULL,

[wr_id_fk_s] [int] NULL,

PRIMARY KEY CLUSTERED

(

[wr_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]



GO

ALTER TABLE [dbo].[tbl_feedbackform] ADD  DEFAULT ((0)) FOR [f_marks]

GO

ALTER TABLE [dbo].[tbl_feedbackform]  WITH CHECK ADD FOREIGN KEY([f_wr_id_fk])

REFERENCES [dbo].[tbl_workshoprecord] ([wr_id])

GO

ALTER TABLE [dbo].[tbl_feedbackform]  WITH CHECK ADD FOREIGN KEY([wr_id_fk_s])

REFERENCES [dbo].[tbl_student] ([s_id])

GO

ALTER TABLE [dbo].[tbl_student]  WITH CHECK ADD FOREIGN KEY([s_batchcode])

REFERENCES [dbo].[tbl_batch] ([b_id])

GO

ALTER TABLE [dbo].[tbl_workshoprecord]  WITH CHECK ADD FOREIGN KEY([wr_id_fk_w])

REFERENCES [dbo].[tbl_workshopname] ([w_id])

GO

ALTER TABLE [dbo].[tbl_workshoprecord]  WITH CHECK ADD FOREIGN KEY([wr_id_fk_i])

REFERENCES [dbo].[tbl_instructor] ([i_id])

GO

ALTER TABLE [dbo].[tbl_workshoprecordforstudent]  WITH CHECK ADD FOREIGN KEY([wr_id_fk_w])

REFERENCES [dbo].[tbl_workshoprecord] ([wr_id])

GO

ALTER TABLE [dbo].[tbl_workshoprecordforstudent]  WITH CHECK ADD FOREIGN KEY([wr_id_fk_s])

REFERENCES [dbo].[tbl_student] ([s_id])

GO

USE [master]

GO

ALTER DATABASE [workshops] SET  READ_WRITE

GO


Friday, 1 June 2018

3-Variable in php with previous commands practice







<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>lesson 3</title>

</head>



<body>

<?php

$x=5;

$y=10;



print "<h1> Before swapping  </h1>";



echo "value of x = ".$x;

echo "<br/>value of y = ".$y;





print "<h1> After swapping  </h1>";



$x= $x+$y; // 5+10 =15

$y=$x-$y; //15-10 =5

$x=$x-$y; //15-5=10



echo "value of x = ".$x;

echo "<br/>value of y = ".$y;









?>





</body>

</html>

2 Print Command in PHP, Difference between print and echo





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>lesson 2</title>

</head>



<body>

<?php

echo " this is written through echo .......salman ","ali ", " Ahmed <br/>";



print(" <h1>this is written through print commnad salman ali  </h1>");



?>





</body>

</html>

1-introduction to PHP , How to start xampp & echo command in hindi( basi...





<?php



echo" this is echo command and beginning of php";



echo"<h1> this is echo command and beginning of php </h1>";



?>

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Lesson 1</title>

</head>



<body>

<h1> printing escaping characters </h1>

<?php



echo "this is echo command with  \" escaping\" characters";



?>



<h1> printing VARIABLE </h1>



<?php

$x="salmanmasood";

echo "hello my name is ".$x;

?>



</body>

</html>

File Handling in C language READ operation

#include <stdio.h>
main()
{

   FILE *fp;
   char buff[255];//creating char array to store data of file
 
   fp = fopen("C:\\Users\\salman\\Desktop\\c-lang\\lect-14\\files\\salman.txt", "r");
   
   while(fscanf(fp, "%s", buff)!=EOF)
   {
   
   printf("%s ", buff );
 
   }
   fclose(fp);
}

File Handling in C language Write operation





#include <stdio.h>

#include <string.h>



main()

{

char c[50];

FILE *fp;

fp=fopen("C:\\Users\\salman\\Desktop\\c-lang\\lect-14\\files\\salman.xls","w");

printf("Enter some thing to write in file.......");

gets(c);

//now writing data into file....

fprintf(fp,c);

//now closing file....

fclose(fp);











}

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