第三级产品展现 
后台相应代码:  
if(!IsPostBack)
            {   
                String AName =Session["AName"].ToString() ;
                String BName =Session["BName"].ToString(); 
                String Name =(String)(Request.QueryString["Name"]);
                Session["Name"]=Name; 
                ANameT.Text =AName;
                BNameT.Text=BName;
                NameT.Text =Name; 
                adminDB Category = new adminDB();
                Repeater1.DataSource =Category.Products_Name_List(Name);
                Repeater1.DataBind(); 
            }  
6.2.4 数据库备份与还原
1)数据库备份 
public bool Backup()
        {            
            string 
path=@"C:\BACKUP\ESMS.bak";
            string backupSql="use ESMS backup database ESMS to disk="+path;            
            // Create Instance of Connection and Command Object
            SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ESMS"]);
            SqlCommand myCommand = new SqlCommand(backupSql,myConnection);            
            try
            {
                myCommand.Connection.Open();
                myCommand.ExecuteNonQuery();
                return true;
            }
            catch(Exception ex)
            {
                return false;
            }
            finally
            {
            myCommand.Connection.Close();
            }
              } 
2) 还原数据库 
public bool Restore()
        {            
            string 
path=@"C:\BACKUP\ESMS.bak";
            string backupSql="use ESMS restore database ESMS from disk="+path;            
            // Create Instance of Connection and Command Object
            SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ESMS"]);
            SqlCommand myCommand = new SqlCommand(backupSql,myConnection);            
            try
            {
                myCommand.Connection.Open();
                myCommand.ExecuteNonQuery();
                return true;
            }
            catch(Exception ex)
            {
                return false;
            }
            finally
            {
                myCommand.Connection.Close();
            }
        } 
6.2.5相关类库
    public class adminDB
    {
        public adminDB()
        {            
        } 
        //产品类型配置
2
        public void  CategoryAdd(String Name, String BName,String AName,String Desn,String Topic)
        {                
            // Create Instance of Connection and Command Object
            SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ESMS"]);
            SqlCommand myCommand = new SqlCommand("CategoryAdd", myConnection); 
            // Mark the Command as a SPROC
            myCommand.CommandType = CommandType.StoredProcedure; 
            // Add Parameters to SPROC
            SqlParameter parameterName = new SqlParameter("@Name", SqlDbType.VarChar ,30);
            parameterName.Value = Name;
            myCommand.Parameters.Add(parameterName); 
            SqlParameter parameterBName = new SqlParameter("@BName", SqlDbType.VarChar ,30);
            parameterBName.Value = BName;
            myCommand.Parameters.Add(parameterBName); 
            SqlParameter parameterAName = new SqlParameter("@AName", SqlDbType.VarChar ,30);
            parameterAName.Value = AName;
            myCommand.Parameters.Add(parameterAName);  
            SqlParameter parameterDesn = new SqlParameter("@Desn", SqlDbType.VarChar,80 );
            parameterDesn.Value = Desn;
            myCommand.Parameters.Add(parameterDesn); 
            SqlParameter parameterTopic = new SqlParameter("@Topic", SqlDbType.Char ,10 );
            parameterTopic.Value = Topic;
            myCommand.Parameters.Add(parameterTopic); 
            myConnection.Open();
            myCommand.ExecuteNonQuery();
            myConnection.Close();        
        } 
        //产品列表
        public SqlDataReader Category_AName_List()
        {                
            // Create Instance of Connection and Command Object
            SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ESMS"]);
            SqlCommand myCommand = new SqlCommand("Category_AName_List", myConnection); 
            // Mark the Command as a SPROC
 << 上一页  [21] [22] [23] [24] [25] [26] [27] [28] [29] [30]  ... 下一页  >> 
ASP+SQL SERVER2000电子商城系统 第24页下载如图片无法显示或论文不完整,请联系qq752018766