Showing posts with label ms sql server. Show all posts
Showing posts with label ms sql server. Show all posts

Wednesday, August 1, 2018

how to create student Database Management system : Sradha Webcreations

Student Data Base Management System 
asp.net Sql Server





using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Security;


public partial class IF_ELSE_AND_OR_PERCENTAGE : System.Web.UI.Page
{ 
    protected void TextBoxTOTALMARKS_TextChanged1(object sender, EventArgs e)
    {
        string sName = TextBoxNAME.Text;
        double dTotalMark =Convert.ToDouble( TextBoxTOTALMARKS.Text);
        double dpercentages;
       
        dpercentages=(dTotalMark/1000)*100;
        TextBoxPERCENTAGE.Text=Convert.ToString(dpercentages);
        string sGrade;
       
        if(dpercentages>=60)
        {
            sGrade="A";
        }
         else if(dpercentages>=50 && dpercentages<60)
        {
            sGrade="B";
        }
        else if(dpercentages>=40 && dpercentages<50 )
        {
            sGrade="C";
        }
        else
        {
            sGrade="F";
        }
        TextBoxGRADE.Text=Convert.ToString(sGrade);
        }}







Saturday, July 28, 2018

how to create Employee management system | Sradha webcreations

Employee management system in asp.net + Sql Server

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Security;

public partial class if_else_SalaryCalculation : System.Web.UI.Page
{
       
    protected void TextBoxEXPERIENCE_TextChanged(object sender, EventArgs e)
    {
        string sEmployeeName = TextBoxEMPLOYEE.Text;
        double dBasic =Convert.ToDouble( TextBoxBASIC.Text);
        double dAnual;
        double dtotal;
       
        dAnual = dBasic * 12;
        TextBoxANUAL.Text = Convert.ToString(dAnual);

        int iAge = Convert.ToInt32(TextBoxAGE.Text);
        double dExperience = Convert.ToDouble(TextBoxEXPERIENCE.Text);
        double dBonus;
        if (iAge > 35 && dExperience > 3)
        {
            dBonus = dAnual * 11 / 100;
            dtotal = dAnual + dBonus;
        }
        else
        {
            dBonus = 0;
            dtotal = dAnual;
        }
        TextBoxBONUS.Text = Convert.ToString(dBonus);
        TextBoxTOTAL.Text = Convert.ToString(dtotal);
        }
    }








Wednesday, July 25, 2018

DATE DATA TYPE CALCULATION IN ASP.NET | Sradha webcreations

DATE DATA TYPE CALCULATION 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.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class LIBRARY : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ButtonTOTALDAY_Click(object sender, EventArgs e)
    {
        string sCardNumber;
        string sBookNumber;
        string sStudentName;
       
        string sIssuedDate=TextBoxISSUE.Text;
        DateTime d1=Convert.ToDateTime(sIssuedDate);

        string sReturnDate=TextBoxRETURN.Text;
        DateTime d2=Convert.ToDateTime(sReturnDate);
     
        int iNumberOfDay;

        sCardNumber = TextBoxCARD.Text;
        sBookNumber = TextBoxBOOK.Text;
        sStudentName = TextBoxNAME.Text;
        
       iNumberOfDay = ((TimeSpan)(d2-d1)).Days;
       TextBoxNOOFDAY.Text = Convert.ToString(iNumberOfDay);

    }

    protected void ButtonSAVE_Click(object sender, EventArgs e)
    {
        string connectionstring= ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
        string insertsql = "insert into library(cardnumber,bookname,name,issueddate,returndate,noofday)values(@cardnumber,@bookname,@name,@issueddate,@returndate,@noofday)";

  using (SqlConnection myconnection = new SqlConnection(connectionstring))
        {
            myconnection.Open();
       SqlCommand mycommand = new SqlCommand(insertsql,myconnection);
           mycommand.Parameters.AddWithValue("@cardnumber",TextBoxCARD.Text);
           mycommand.Parameters.AddWithValue("@bookname",TextBoxBOOK.Text);
            mycommand.Parameters.AddWithValue("@name",TextBoxNAME.Text);
            mycommand.Parameters.AddWithValue("@issueddate",TextBoxISSUE.Text);
            mycommand.Parameters.AddWithValue("@returndate",TextBoxRETURN.Text);
            mycommand.Parameters.AddWithValue("@noofday",TextBoxNOOFDAY.Text);

            mycommand.ExecuteNonQuery();
            myconnection.Close();
             }
        TextBoxCARD.Text = string.Empty;
        TextBoxBOOK.Text = string.Empty;
        TextBoxNAME.Text = string.Empty;
        TextBoxISSUE.Text = string.Empty;
        TextBoxRETURN.Text = string.Empty;
        TextBoxNOOFDAY.Text = string.Empty;
    }
 }Bottom of Form


Tuesday, July 24, 2018

how to calculate AREA OF A CIRCLE in asp.net | sradha webcreations



AREA OF A CIRCLE


            ENTER RADIUS OF A CIRCLE


            THE AREA OF CIRCLE IS




using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ButtonCALCULATE_Click(object sender, EventArgs e)
    {
        float fRadius;
        float fArea;

        fRadius = Convert.ToInt32(TXTRADIUS.Text);
        fArea = (3*(fRadius*fRadius));
        TXTAREA.Text = Convert.ToString(fArea);

    }
    protected void ButtonSAVE_Click(object sender, EventArgs e)
    {
  string connectionString = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
string insertSql = "INSERT INTO circle(radious,area) VALUES(@radious,@area)";

        using (SqlConnection myConnection = new SqlConnection(connectionString))
        {
            myConnection.Open();
  SqlCommand myCommand = new SqlCommand(insertSql, myConnection);
  myCommand.Parameters.AddWithValue("@radious", TXTRADIUS.Text);
  myCommand.Parameters.AddWithValue("@area", TXTAREA.Text);

            myCommand.ExecuteNonQuery();
            myConnection.Close();
        }

        // "Reset" the Subject and Body TextBoxes
        TXTRADIUS.Text = string.Empty;
        TXTAREA.Text = string.Empty;
        
    }
}