There are tons of sample code online as to how to do this.
Here is just one example of how to do this: http://geekswithblogs.net/dotNETvinz/archive/2009/04/30/creating-a-simple-registration-form-in-asp.net.aspx
you define the text boxes between the following tag:
<form id="form1" runat="server">
you create your textboxes and define them to runat="server" like so:
<asp:TextBox ID="TxtName" runat="server"></asp:TextBox>
define a button to process your logic like so (notice the onclick):
<asp:Button ID="Button1" runat="server" Text="Save" onclick="Button1_Click" />
in the code behind, you define what you want the server to do if the user clicks on the button by defining a method named
protected void Button1_Click(object sender, EventArgs e)
or you could just double click the button in the design view.
Here is a very quick sample of code to insert into a table in the button click event (codebehind)
protected void Button1_Click(object sender, EventArgs e)
{
string name = TxtName.Text; // Scrub user data
string connString = ConfigurationManager.ConnectionStrings["yourconnstringInWebConfig"].ConnectionString;
SqlConnection conn = null;
try
{
conn = new SqlConnection(connString);
conn.Open();
using(SqlCommand cmd = new SqlCommand())
{
cmd.Conn = conn;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "INSERT INTO dummyTable(name) Values (@var)";
cmd.Parameters.AddWithValue("@var", name);
int rowsAffected = cmd.ExecuteNonQuery();
if(rowsAffected ==1)
{
//Success notification
}
else
{
//Error notification
}
}
}
catch(Exception ex)
{
//log error
//display friendly error to user
}
finally
{
if(conn!=null)
{
//cleanup connection i.e close
}
}
}