Create an asp.net page for new registration and
insert record in sql database. Show the inserted records on another page.
using System;
using
System.Configuration;
using
System.Data;
using
System.Linq;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.HtmlControls;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Xml.Linq;
using
System.Data.SqlClient;
public partial
class _Default : System.Web.UI.Page
{
SqlConnection con = new
SqlConnection("Data Source=.;Initial Catalog=Atif;Integrated
Security=True;Pooling=False");
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
protected void Page_Load(object sender,
EventArgs e)
{
}
protected void Button1_Click(object sender,
EventArgs e)
{
string str="insert into
Registation values('"+TextBox1 .Text +"','"+TextBox2 .Text
+"','"+TextBox3 .Text +"','"+TextBox4 .Text
+"','"+TextBox5 .Text +"','"+TextBox6 .Text
+"','"+TextBox7 .Text +"')";
SqlCommand cmd = new SqlCommand(str,
con);
cmd .Connection .Open ();
cmd .ExecuteNonQuery ();
cmd .Connection .Close ();
Response.Write("Record
insert");
}
}