hi.. need some help in c# classes

i have an aspx.cs file which in it has a reference from my webconfig file for the connection to my sql server database... also in my aspx.cs file i have the Save functionality.

i would like to create a class which has a connection and also the save functionality then i call this class into my aspx.cs file. i have been reading and i am bit confused...why? cause i am new to c# .....

can someone tell me

the structure of the class.. meaning how i should code the class in order to achieve a class with functionality then call in into my aspx.cs file

if i create a class do i need to run the command prompt of vs.net in order to create the a dll, or is there another way to create a dll in order to call my class.

thanks in advance....

below is my code for which is in my aspx.cs file

Code:
private void butSave_Click(object sender, System.EventArgs e)
		{
			string constring;
			SqlParameter paramReturn;
			SqlCommand sqlcomm;
			SqlConnection myconn;

			constring = ConfigurationSettings.AppSettings["connstr"];

			myconn = new SqlConnection( constring );
	
			sqlcomm= new SqlCommand( "GroupsAdd", myconn);
			sqlcomm.CommandType= CommandType.StoredProcedure;

			paramReturn = sqlcomm.Parameters.Add("@return",SqlDbType.Int);
			paramReturn.Direction = ParameterDirection.ReturnValue;

			if (str != null)
			{
				sqlcomm.Parameters.Add( "@groupname" , str);
			}
			else
			{
				sqlcomm.Parameters.Add( "@groupname" , txtGroupName.Text);
			}			

			myconn.Open();
			sqlcomm.ExecuteNonQuery();
			myconn.Close();

			if((int)sqlcomm.Parameters["@Return"].Value == 0)
			  {
				  lblMessage.Text = "GroupName has been saved";
			  }
			  else
			  {
				  lblMessage.Text ="GroupName already exists";
			  }
							

		}