|
|
|
ENTER FARENHEIT
|
|
|
CENTIGRADE
|
|
|
|
|
|
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 btncalculate_Click(object sender, EventArgs
e)
{
float
fFarenheit;
float
fcentigrade;
fFarenheit = Convert.ToInt32(txtfarenheit.Text);
fcentigrade=(fFarenheit-32)*5/9;
TXTCENTIGRADE.Text = Convert.ToString(fcentigrade);
}
protected void btnsave_Click(object
sender, EventArgs e)
{
string
connectionString = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
string
insertSql = "INSERT INTO conversion(farenheit,centigrade)
VALUES(@farenheit,@centigrade)";
using
(SqlConnection myConnection = new SqlConnection(connectionString))
{
myConnection.Open();
SqlCommand
myCommand = new SqlCommand(insertSql,
myConnection);
myCommand.Parameters.AddWithValue("@farenheit", txtfarenheit.Text);
myCommand.Parameters.AddWithValue("@centigrade", TXTCENTIGRADE.Text);
myCommand.ExecuteNonQuery();
myConnection.Close();
}
//
"Reset" the Subject and Body TextBoxes
txtfarenheit.Text = string.Empty;
TXTCENTIGRADE.Text = string.Empty;
}
}
|
#SradhaWebCreations
Contact : +91-9040573923, +91-7008182025
http://sradhawebcreations.com/
http://sradhawebcreations.blogspot.in/
https://facebook.com/sradhawebcreations
https://www.facebook.com/Sradhawebeducation/Contact : +91-9040573923, +91-7008182025
http://sradhawebcreations.com/
http://sradhawebcreations.blogspot.in/
https://facebook.com/sradhawebcreations