Thursday 28 June 2018

How To display All Data from SQL server table in Visual C# Gridview







click here to download the source code

Unlink and Append in PHP





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Write</title>

</head>



<body>



<form method="post">

<table>

<tr>  <td>Text </td> <td> <input type="text" name="txt"/> </td> </tr>

<tr> <td colspan="2"> <button name="btn">Post</button> </td> </tr>

<tr> <td colspan="2"> <button name="del">Delete</button> </td> </tr>



</table>

</form>



<?php

if(isset($_POST['btn']))

{



$filename="Resources/salman.txt";

$handle=fopen($filename,'a');

fwrite($handle," ".$_POST['txt']);

fclose($handle);

echo "Data successfully Inserted.....";





}



if(isset($_POST['del']))

{

$status=unlink("Resources/salman.txt");

if($status==true)

{

echo "Deleted.....";

}

else

{

echo "Not Deleted.....";



}

}

?>





</body>

</html>

File Write Operation in PHP





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Write</title>

</head>



<body>



<form method="post">

<table>

<tr>  <td>Text </td> <td> <input type="text" name="txt"/> </td> </tr>

<tr> <td colspan="2"> <button name="btn">Post</button> </td> </tr>

</table>

</form>



<?php

if(isset($_POST['btn']))

{

$filename="Resources/salman.txt";

$handle=fopen($filename,'w');

fwrite($handle,$_POST['txt']);

fclose($handle);

echo "Data successfully Inserted.....";





}

?>





</body>

</html>

File Read Operation in PHP





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Read Operation</title>

</head>



<body>



<?php

$fiepath="Resources/salman.txt";

$handle=fopen($fiepath,"r");

$content=fread($handle,filesize($fiepath));

echo "<h1>".$content." </h1>";

fclose($handle);

?>







</body>

</html>

Monday 25 June 2018

Read Xml File in a gridview in Asp net







using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Xml;



namespace readxmldata

{

    public partial class WebForm1 : System.Web.UI.Page

    {

        List<student> li = new List<student>();

        protected void Page_Load(object sender, EventArgs e)

        {

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(Server.MapPath("~/student.xml"));

            XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes("/Students/student");



            foreach (XmlNode node in nodeList)

            {

                student s = new student();



               s.id = Convert.ToInt32(node.SelectSingleNode("id").InnerText);

               s.name = node.SelectSingleNode("name").InnerText;

               s.age = Convert.ToInt32(node.SelectSingleNode("AGE").InnerText);

               li.Add(s);

            }



            GridView1.DataSource = li;

            GridView1.DataBind();









        }

    }

}

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

class code:

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

    public class student

    {



        public int id { get; set; }

        public string name { get; set; }



        public int age { get; set; }

       

    }

Xml:

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

<?xml version="1.0" encoding="utf-8" ?>

<Students>

  <student>

    <id>1 </id>

    <name>Ali</name>

    <AGE>34</AGE>

  </student>





  <student>

    <id>2 </id>

    <name>AHMED</name>

    <AGE>31</AGE>

  </student>





  <student>

    <id>3 </id>

    <name>SAMI</name>

    <AGE>35</AGE>

  </student>



  <student>

    <id>4 </id>

    <name>BASIT</name>

    <AGE>34</AGE>

  </student>

 

  <student>

    <id>5 </id>

    <name>salman</name>

    <AGE>35</AGE>

  </student>







</Students>

How to Convert Excel Data into XML Document





using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using System.Runtime.InteropServices;

using Excel = Microsoft.Office.Interop.Excel;

using System.Xml;

namespace EXCELTOXML

{

    public partial class Form1 : Form

    {

        List<student> li = new List<student>();

        public Form1()

        {

            InitializeComponent();

        }



        private void Form1_Load(object sender, EventArgs e)

        {



        }



        private void button1_Click(object sender, EventArgs e)

        {



            Excel.Application xlApp;



            Excel.Workbook xlWorkBook;



            Excel.Worksheet xlWorkSheet;



            Excel.Range range;







            int rw = 0;



            int cl = 1;







            xlApp = new Excel.Application();



            xlWorkBook = xlApp.Workbooks.Open(@"C:\images\docs\abc.xls", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);



            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);







            range = xlWorkSheet.UsedRange;



            rw = range.Rows.Count;





            //



            //data read code...............................................



            for (int i = 2; i <= rw; i++)

            {



                student s = new student();



                s.id = (int)(range.Cells[i, 1] as Excel.Range).Value;



                s.Name = (string)(range.Cells[i, 2] as Excel.Range).Value;



                s.Marks = (int)(range.Cells[i, 3] as Excel.Range).Value;



               



                li.Add(s);



            }







            //data read code...............................................







            //



            xlWorkBook.Close(true, null, null);



            xlApp.Quit();







            Marshal.ReleaseComObject(xlWorkSheet);



            Marshal.ReleaseComObject(xlWorkBook);



            Marshal.ReleaseComObject(xlApp);







            dataGridView1.DataSource = li;





        }



        private void button2_Click(object sender, EventArgs e)

        {







            XmlTextWriter writer = new XmlTextWriter(@"C:\images\docs\salman.xml", System.Text.Encoding.UTF8);

            writer.WriteStartDocument(true);

            writer.Formatting = Formatting.Indented;

            writer.Indentation = 2;

            writer.WriteStartElement("Students");

            foreach (var item in li)

            {

                createnode(item, writer);



            }





            writer.WriteEndElement();

            writer.WriteEndDocument();

            writer.Close();

            MessageBox.Show("XML File created ! ");



        }



        private void createnode(student s, XmlTextWriter writer)

        {

            writer.WriteStartElement("Student");

            //id...............................

            writer.WriteStartElement("id");

            writer.WriteString(s.id.ToString());

            writer.WriteEndElement();

            //................name



            writer.WriteStartElement("Name");

            writer.WriteString(s.Name.ToString());

            writer.WriteEndElement();





            //................name



            writer.WriteStartElement("Marks");

            writer.WriteString(s.Marks.ToString());

            writer.WriteEndElement();



       







            writer.WriteEndElement();

       

        }

    }

}


How to export Sql Database records into Excel File







using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Data.SqlClient;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using System.Runtime.InteropServices;

using Excel = Microsoft.Office.Interop.Excel;

namespace sqltoExcel

{

    public partial class Form1 : Form

    {

        private string connctionstring = "Data Source=faculty-35;Initial Catalog=exceltosql;Persist Security Info=True;User ID=sa;Password=aptech";



        public Form1()

        {

            InitializeComponent();

        }



        private void Form1_Load(object sender, EventArgs e)

        {

            // TODO: This line of code loads data into the 'exceltosqlDataSet.tbl_student' table. You can move, or remove it, as needed.

            this.tbl_studentTableAdapter.Fill(this.exceltosqlDataSet.tbl_student);



        }



        private void button1_Click(object sender, EventArgs e)

        {

            SqlConnection cnn;

     

            string sql = null;

            string data = null;

            int i = 0;

            int j = 0;



            Excel.Application xlApp;

            Excel.Workbook xlWorkBook;

            Excel.Worksheet xlWorkSheet;

            object misValue = System.Reflection.Missing.Value;



            xlApp = new Excel.Application();

            xlWorkBook = xlApp.Workbooks.Add(misValue);

            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);





            cnn = new SqlConnection(connctionstring);

            cnn.Open();

            sql = "SELECT * FROM tbl_student";

            SqlDataAdapter dscmd = new SqlDataAdapter(sql, cnn);

            DataSet ds = new DataSet();

            dscmd.Fill(ds);



            for (i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)

            {

                for (j = 0; j <= ds.Tables[0].Columns.Count - 1; j++)

                {

                    data = ds.Tables[0].Rows[i].ItemArray[j].ToString();

                    xlWorkSheet.Cells[i + 1, j + 1] = data;

                }

            }



            xlWorkBook.SaveAs(@"C:\images\docs\studens.xls", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);

            xlWorkBook.Close(true, misValue, misValue);

            xlApp.Quit();



            releaseObject(xlWorkSheet);

            releaseObject(xlWorkBook);

            releaseObject(xlApp);



            MessageBox.Show("Excel file created , you can find the file ");











        }



        private void releaseObject(object obj)

        {

            try

            {

                System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);

                obj = null;

            }

            catch (Exception ex)

            {

                obj = null;

                MessageBox.Show("Exception Occured while releasing object " + ex.ToString());

            }

            finally

            {

                GC.Collect();

            }

        }









    }

}


Tuesday 19 June 2018

How to insert Bulk Data of Excel into Sql server Database







Form 1 Code:



using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using System.Runtime.InteropServices;

using Excel = Microsoft.Office.Interop.Excel;

using exceltosql.Model;



namespace exceltosql

{

    public partial class Form1 : Form

    {

        List<student> li = new List<student>();

        exceltosqlEntities db = new exceltosqlEntities();

        public Form1()

        {

            InitializeComponent();

        }



        private void button1_Click(object sender, EventArgs e)

        {

            Excel.Application xlApp;



            Excel.Workbook xlWorkBook;



            Excel.Worksheet xlWorkSheet;



            Excel.Range range;







            int rw = 0;



            int cl = 1;







            xlApp = new Excel.Application();



            xlWorkBook = xlApp.Workbooks.Open(@"C:\images\docs\salman.xlsx", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);



            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);







            range = xlWorkSheet.UsedRange;



            rw = range.Rows.Count;



           //



            //



            //data read code...............................................



            for (int i = 2; i <= rw; i++)

            {



               student s = new student();



                s.id = (int)(range.Cells[i, cl] as Excel.Range).Value;

                s.Enrolment = (string)(range.Cells[i, ++cl] as Excel.Range).Value;

                s.name = (string)(range.Cells[i, ++cl] as Excel.Range).Value;

                s.batchcode = (string)(range.Cells[i, ++cl] as Excel.Range).Value;

               

               cl = 1;



                li.Add(s);



            }







            //data read code...............................................







            //



            xlWorkBook.Close(true, null, null);



            xlApp.Quit();







            Marshal.ReleaseComObject(xlWorkSheet);



            Marshal.ReleaseComObject(xlWorkBook);



            Marshal.ReleaseComObject(xlApp);







            dataGridView1.DataSource = li;



        }



        private void button2_Click(object sender, EventArgs e)

        {

            foreach (var item in li)

            {

                tbl_student s = new tbl_student();

                s.s_id = item.id;

                s.s_name = item.name;

                s.s_enrollment = item.Enrolment;

                s.s_batchcode = item.batchcode;

                db.tbl_student.Add(s);

                db.SaveChanges();



            }

            MessageBox.Show("Data successfully inserted......");

        }

    }

}

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

student class Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace exceltosql.Model
{
    class student
    {
        public int id { get; set; }

        public string Enrolment { get; set; }

        public string name { get; set; }

        public string batchcode { get; set; }

    }
}

Wednesday 13 June 2018

How to Read Excel File in List and Display in Data gridview





using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using System.Runtime.InteropServices;

using Excel = Microsoft.Office.Interop.Excel;

namespace read_excel

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }



        private void button1_Click(object sender, EventArgs e)

        {

            Excel.Application xlApp;

            Excel.Workbook xlWorkBook;

            Excel.Worksheet xlWorkSheet;

            Excel.Range range;



            int rw = 0;

            int cl = 1;



            xlApp = new Excel.Application();

            xlWorkBook = xlApp.Workbooks.Open(@"C:\images\docs\salman.xls", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);

            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);



            range = xlWorkSheet.UsedRange;

            rw = range.Rows.Count;

            List<student> li = new List<student>();

            //

            //data read code...............................................

            for (int i = 2; i <= rw; i++)

            {

                student s = new student();

                s.id=(int)(range.Cells[i,cl] as Excel.Range).Value;

                s.Name = (string)(range.Cells[i, ++cl] as Excel.Range).Value;

                s.Marks = (int)(range.Cells[i, ++cl] as Excel.Range).Value;

                cl = 1;

                li.Add(s);

            }



            //data read code...............................................



            //

            xlWorkBook.Close(true, null, null);

            xlApp.Quit();



            Marshal.ReleaseComObject(xlWorkSheet);

            Marshal.ReleaseComObject(xlWorkBook);

            Marshal.ReleaseComObject(xlApp);



            dataGridView1.DataSource = li;



        }

    }

}

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


class student
    {
        public int id { get; set; }
        public string Name { get; set; }
        public int Marks { get; set; }


    }

Tuesday 12 June 2018

How to Create Excel File in Windows Form C#





using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using System.Runtime.InteropServices;

using Excel = Microsoft.Office.Interop.Excel;



namespace WindowsFormsApplication7

{

    public partial class Form1 : Form

    {

        Excel.Application xlApp = new Excel.Application();

        public Form1()

        {

            InitializeComponent();

        }



        private void Form1_Load(object sender, EventArgs e)

        {

            if (xlApp == null)

            {

                label1.Text = "Excel Libary is not installed ";

                label1.ForeColor = System.Drawing.Color.Red;

            }

            else

            {

                label1.Text = "Excel Libary is  installed ";

                label1.ForeColor = System.Drawing.Color.Green;

         

            }

        }



        private void button1_Click(object sender, EventArgs e)

        {

            Excel.Workbook xlWorkBook;

            Excel.Worksheet xlWorkSheet;

            object misValue = System.Reflection.Missing.Value;



            xlWorkBook = xlApp.Workbooks.Add(misValue);

            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);



            xlWorkSheet.Cells[1, 1] = "StudentID";

            xlWorkSheet.Cells[1, 2] = "Student Name";

            xlWorkSheet.Cells[1, 3] = "Marks";



            xlWorkSheet.Cells[2, 1] = "1";

            xlWorkSheet.Cells[2, 2] = "Ali";

            xlWorkSheet.Cells[2, 3] = "50";



            xlWorkSheet.Cells[3, 1] = "2";

            xlWorkSheet.Cells[3, 2] = "Salman";

            xlWorkSheet.Cells[3, 3] = "60";





            xlWorkSheet.Cells[4, 1] = "3";

            xlWorkSheet.Cells[4, 2] = "Arsalan";

            xlWorkSheet.Cells[4, 3] = "100";







            xlWorkBook.SaveAs(@"C:\images\docs\salman.xls", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);

            xlWorkBook.Close(true, misValue, misValue);

            xlApp.Quit();



            Marshal.ReleaseComObject(xlWorkSheet);

            Marshal.ReleaseComObject(xlWorkBook);

            Marshal.ReleaseComObject(xlApp);



            MessageBox.Show("Excel file created , you can find the file d:\\csharp-Excel.xls");

        }



    }

}


Sunday 10 June 2018

How to calculate age from date of birth in c# windows application





 private void button2_Click(object sender, EventArgs e)

        {

            DateTime fdate = new DateTime(2000, 6, 1);

            DateTime sdate = new DateTime(2018, 6, 11);

            string diff = (sdate - fdate).TotalDays.ToString();

            int totaldays = Convert.ToInt32(diff);

            int year = totaldays / 365;

            int remainingdays = totaldays % 365;

            int month = Convert.ToInt32(remainingdays / 30.41);

            remainingdays = remainingdays % 30;

            label1.Text = year + " years , " + month + " months and " + remainingdays + " days";













        }

Wednesday 6 June 2018

$POST Request in php







<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>post</title>

</head>



<body>



<form method="post">

Name:<input type="text"  name="name"/ >

Email:<input type="text"  name="email"/ >



<button type="submit" value="submit">  submit</button>



</form>



<?php

if($_SERVER['REQUEST_METHOD']=="POST")

{

$name=$_POST['name'];

$email=$_POST['email'];



if(empty($name) || empty($email))

{

echo "<p style='color:red'> * </p>";



}

else

{

echo "<p style='color:green'> Name: ".$name." </p>";

echo "<p style='color:green'> Email: ".$email." </p>";

}



}

?>







</body>

</html>

$_Get method in php (Super Global variable)





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Untitled Document</title>

</head>



<body>

<form method="get">

<input type="text" name="fname"/>

<input type="text" name="email"/>

<button type="submit" value="submit"> Submit </button>



</form>



<?php



if($_SERVER['REQUEST_METHOD']=="GET")

{

$name= $_GET['fname'];

$email= $_GET['email'];

if(empty($name) || empty($email) )

{

echo "<P style='color:red'> No name present..... </p>";



}

else

{

echo "<P style='color:red'> Name : ".$name." </p>";



echo "<P style='color:red'> email : ".$email." </p>";

}



}

?>





</body>

</html>

SUPER GLOBAL VARIABLE IN PHP $server and $Global





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>GLOBAL</title>

</head>



<body>

<?php

$x=10;

$y=20;



function myfun()

{

$GLOBALS['x']=$GLOBALS['x']+$GLOBALS['y'];



//echo "value of x = ".$x;



}

myfun();

//echo "value of x = ".$x;

echo "PHP REFERENCE=".$_SERVER['HTTP_REFERER'];

?>







<?php

echo $_SERVER['PHP_SELF'];

echo "<br>";

echo $_SERVER['SERVER_NAME'];

echo "<br>";

echo $_SERVER['HTTP_HOST'];

echo "<br>";

echo $_SERVER['HTTP_REFERER'];

echo "<br>";



?>





</body>

</html>

Tuesday 5 June 2018

workshopmanagement system 3





USE [master]

GO

/****** Object:  Database [workshops]    Script Date: 6/5/2018 3:31:02 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/5/2018 3:31:02 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) ,

@ad_fk_ad int

)

as

begin



insert into  tbl_instructor

values(@i_name   ,

@i_designation   ,

@i_image ,

@ad_fk_ad)

end







GO

/****** Object:  Table [dbo].[Employee]    Script Date: 6/5/2018 3:31:02 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_admin]    Script Date: 6/5/2018 3:31:02 PM ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[tbl_admin](

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

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

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

PRIMARY KEY CLUSTERED

(

[ad_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

(

[ad_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_batch]    Script Date: 6/5/2018 3:31:02 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/5/2018 3:31:02 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/5/2018 3:31:02 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,

[ad_fk_id] [int] 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/5/2018 3:31:02 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/5/2018 3:31:02 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/5/2018 3:31:02 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/5/2018 3:31:02 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_instructor]  WITH CHECK ADD FOREIGN KEY([ad_fk_id])

REFERENCES [dbo].[tbl_admin] ([ad_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


Monday 4 June 2018

comparison operator in php





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>comparison operator..</title>

</head>



<body>

<?php

$a=10;

$b=5;

$c=10;







if($a === $b)

{

echo " <p style='color:green'>success </p>" ;

}



else

{

echo "<p style='color:red'> failure </p>" ;

}

echo "<h1> >= Operator </h1>";



echo "a>=b =".($a>=$b);



echo "<h1> <= Operator </h1>";



echo "a<=b =".($a<=$b);



echo "<h1> == Operator </h1>";



echo "a==b =".($a==$b);



echo "<h1> != Operator </h1>";



echo "a!=b =".($a!=$b);







echo "<h1> === Operator </h1>";



echo "a===c =".($a===$c);







?>





</body>

</html>

Assignment Operator in php





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>assignment operator</title>

</head>



<body>



<?php

$x=4;



echo "<h1> = operator </h1> ";





$y=$x;



echo "value of y = ".$y;

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



echo "<h1> += operator </h1> ";



$y+=$x; // y=y+x

echo "value of y = ".$y;

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



echo "<h1> -= operator </h1> ";



$y-=$x; // y=y-x

echo "value of y = ".$y;

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





echo "<h1> *= operator </h1> ";



$y*=$x; // y=y*x

echo "value of y = ".$y;

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





echo "<h1> /= operator </h1> ";



$y/=$x; // y=y/x

echo "value of y = ".$y;

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





















?>









</body>

</html>

Airthmetic Operator in PHP



<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Airthmatic operator</title>

</head>



<body>



<?php

$a=10;

$b=5;



echo "<h1>Addtion </h1>";

echo "a + b = ".($a+$b);



echo "<h1>Subtraction </h1>";

echo "a - b = ".($a-$b);



echo "<h1>Multiplication </h1>";

echo "a * b = ".($a*$b);



echo "<h1>Division </h1>";

echo "a / b = ".($a/$b);



echo "<h1>Modulus </h1>";

echo "a % b = ".($a%$b);



echo "<h1>Exponent </h1>";

//echo "a ^ b = ".($a**$b);

echo "a ^ b = ".pow($a,$b);

























?>













</body>

</html>

variable scope in php





<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>variable scope..</title>

</head>



<body>



<h1>variable scope </h1>



<?php

echo "<h2>Local variable </h2>";



function myfun1()

{

$x=15; //local .......

echo "value of inside the function  x = ".$x;

}





myfun1();

//echo "value of outside the function x = ".$x;



echo "<h2>Global variable </h2>";



$y=10;

$z=20;

function myfun2()

{

//echo "value of y inside the function = ".$y;

}



myfun2();



echo "value of y outside the function = ".$y;





echo "<h2>Global keyword </h2>";

function myfun3()

{

global $y,$z;

$y=$y+$z;

echo "value of y inside the function = ".$y;



}



myfun3();





echo "<h2>static variable </h2>";



function myfun4()

{

static $a=0;

$a++;

echo "value of a inside the function = ".$a."<br/>";





}



myfun4();

myfun4();

myfun4();



?>













</body>

</html>

Sunday 3 June 2018

Custom Exception in C# Error Handling



----------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication37
{
    class CustomEXception:Exception
    {
        public CustomEXception(string msg):base (msg)
        {

        }
       

    }
}


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

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;



namespace ConsoleApplication37

{

    class Program

    {

        public static void checkage(int age)

        {

            if (age<18)

            {

                throw new CustomEXception("Age should be greater than 18...");

            }

            else

            {

                Console.WriteLine("Eligible to enrolled in exam....");

            }



        }

        static void Main(string[] args)

        {

         

            int age ;

        l1:

        Console.WriteLine("Enter the age: ");

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

            try

            {

                checkage(age);

            }

            catch( CustomEXception e)

            {

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

               // throw;

            }

         

            finally

            {



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

                Console.ReadLine();

                Console.Clear();

            }



            goto l1;

        }

    }

}


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