above is correct, but you may want to read up on constructing layers (data access layer / business logic layer) as you do not want everything to happen on your code behind.
Well theres two ways this can be done articture wise
Connected one has already been posted
Disconnected one
//i hope you know how a connection String is formed
SqlConnection con=new SqlConnection(connectionString);
//data set holds the schema
DataSet ds=new DataSet();
SqlDataAdapter da=new SqlDataAdapter("select * from db",con);
da.Fill("tablename");
//Command builder builds the command for you
SqlCommandBuilder cbd=new SqlCommandBuilder(da);
//data table holds a particular table
DataTable dt=ds.Tables["tablename"];
// add a new blank row
DataRow dr=dt.Rows.Add();
//start adding rows
dr[0]="Primary key";
dr[1]="name";
dr[2]=double.Parse(textBox1.Text);
//done? then commit the row
int rowAdded=da.Update("tablename");
Response.Write(rowAdded.ToString()+" no. of rows added");