using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
/// <summary>
/// SqlUpdate 的摘要说明
/// </summary>
public class SqlUpdate
{
	public SqlUpdate()
	{
		//
		// TODO: 在此处添加构造函数逻辑
		//
	}
    public void UpdateClassInfo(string ClassID, string EntranceTime,int ManCount,string TeacherName,string Grade,string State)
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
        con.Open();
        string sql = "update ClassInfo set EntranceTime='"+EntranceTime+"',ManCount='"+ManCount+"',TeacherName='"+TeacherName+"',Grade='"+Grade+"',State='"+State+"' where classid='"+ClassID+"'";
        SqlCommand com = new SqlCommand(sql,con);
        com.ExecuteNonQuery();
        com.Dispose();
        con.Close();

    }
    public int UpdateStudentInfo(int StudentId,string Name,int Age,string Sex,string Address,string Phone,string ClassID)
    {
        int i = 0;
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);
        con.Open();
        string sql = "Update StudentInfo set name='" + Name + "',age=" + Age + ",sex='" + Sex + "',address='" + Address + "',Phone='" + Phone + "',ClassID='" + ClassID + "'  where studentID="+StudentId+"";
        SqlCommand com = new SqlCommand(sql,con);
        i = com.ExecuteNonQuery();
        return i;
   
    }
}
