Web Application in ASP.NET c# (Part 3) | Tutorials in 6 parts
HTML-код
- Опубликовано: 10 сен 2024
- How to Develop a Web Application in ASP.NET c# | BASIC ASP.NET c# Tutorials in 6 parts
Create a Web Application in ASP.NET c# | Tutorials in 6 parts
Part 1 - Introduction and Creating form • Web Application in ASP...
Part 2 - Connecting Database • Web Application in ASP...
Part 3 - Insert into Database Table • Web Application in ASP...
Part 4 - Delete record from Database Table • Web Application in ASP...
Part 5 - Modify/Edit Record in Database Table • Web Application in ASP...
Part 6 - Gridview with Dropdown list search • Web Application in ASP...
ALSO OTHER VIDEOS
UNBOXING MICROPHONE MB 800 • Unboxing BM-800 Conden...
How to Create 100's of Annual Progress Report Cards for Students in School (Report Card) • How to Create 100's o...
HOW TO USE MS EXCEL INDIRECT FUNCTION, VLOOKUP FUNCTION AND MATCH FUNCTION IN REAL LIFE. • HOW TO USE MS EXCEL IN...
Maintain Stock Inventory Auto Update in MS Excel • Maintain Stock Invento...
Creating invoice with List box and Vlookup command • Creating invoice with ...
MS Excel Advance Macro Data Filter • MS Excel Advance Macro...
MS Excel Worksheet Macro • MS Excel Worksheet M...
Consolidate Function MS Excel • Consolidate Function M...
Ten Pin Bowling practice • Ten Pin Bowling practi...
Importance of Arafat 9th day of Dhu Al Hijja ????? ????? ?????? ?? ?? ????? • Importance of Arafat 9...
Prayer (Salat, Namaj, Namaz) • Prayer (Salat, Namaj, ...
===============
Script to copy:
===============
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
namespace Part1
{
public partial class Creatform : System.Web.UI.Page
{
SqlConnection Con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
Con.Open();
}
protected void ButtonSubmit_Click(object sender, EventArgs e)
{
string vareducation = "";
if (CheckBoxDegree.Checked)
{
vareducation += CheckBoxDegree.Text;
}
if (CheckBoxDiploma.Checked)
{
vareducation += CheckBoxDiploma.Text;
}
if (CheckBoxSchool.Checked)
{
vareducation += CheckBoxSchool.Text;
}
string vargender = "";
if (RadioButtonFemale.Checked)
{
vargender = "Female";
}
else if (RadioButtonMale.Checked)
{
vargender = "Male";
}
SqlCommand cmd = new SqlCommand("insert into contact values('" + textboxfname.Text + "', '" + TextBoxlname.Text + "','" + TextBoxemail.Text + "','" + DropDownListCountry.SelectedValue.ToString() + "','" + vargender.ToString() + "', '"+vareducation.ToString() +"')", Con);
cmd.ExecuteNonQuery();
Con.Close();
textboxfname.Text = "";
TextBoxlname.Text = "";
TextBoxemail.Text = "";
RadioButtonFemale.Checked = false;
RadioButtonMale.Checked = false;
CheckBoxDegree.Checked = false;
CheckBoxDiploma.Checked = false;
CheckBoxSchool.Checked = false;
GridView1.DataBind();
}
}
}