⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 course_upt.aspx

📁 本文件为ASP开发的在线播放系统,挺不错的,创建数据需按照说明进行创建,祝你成功!
💻 ASPX
字号:
<!-- #include virtual="/include/PageDirective.inc" -->
<!-- #include virtual="/include/imports.inc" -->
<!-- #include virtual="/include/common_function.inc" -->
<html>
<head>
<link REL="StyleSheet" HREF="/css/standard.css" >
<script language="C#" runat="server">

/*************************************************
* 模块: course.aspx	
* 作者: miles	
* 修改: 1/30/2001
* 目的: course table maintain
* 参数: none
* 数据: sel: course
*       ins: course
*       del: course
*       upt: none
***************************************************/

private void Page_Load(Object sender, EventArgs E) {
   try {
       if (IsPostBack)
		return;		
	SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["edu"]);
	SqlCommand myCommand = new SqlCommand("select * from course where course_id='"+Request["course_id"]+"'", myConnection);
	SqlDataReader MyReader;        
	myConnection.Open();
	MyReader=myCommand.ExecuteReader();
	while (MyReader.Read()){
	   course_id.Text=MyReader["course_id"].ToString(); 
	   course_name.Text=MyReader["course_name"].ToString(); 
	   course_english_name.Text=MyReader["course_english_name"].ToString(); 
	   course_alias.Text=MyReader["course_alias"].ToString(); 
	   total_hour.Text=MyReader["total_hour"].ToString(); 
	   amount.Text=MyReader["amount"].ToString(); 
	   course_catalog_id.Text=MyReader["course_catalog_id"].ToString(); 
	}
	myConnection.Close(); 
	myConnection.Open(); 
	SqlDataAdapter myCommandcourse_catalog = new SqlDataAdapter("select course_catalog_id,course_catalog_name from course_catalog",myConnection);	
	DataSet ds1 = new DataSet();
       	myCommandcourse_catalog.Fill(ds1, "course_catalog");
	course_catalog_list.DataSource=ds1.Tables["course_catalog"].DefaultView;
	course_catalog_list.DataBind();
	if (course_catalog_id.Text!=""){
	   int i =0;
	   foreach( DataRow course_catalog in ds1.Tables["course_catalog"].Rows) 
	   { 
	      if (course_catalog_id.Text==course_catalog["course_catalog_id"].ToString())
	         break; 
	      i=i+1;
	   } 
	   course_catalog_list.Items[i].Selected=true;
	}
   }
   catch (System.Exception e){
        ErrorHandler(e.ToString());
   }  
}
	
private void BackBtn_Click(Object Sender, EventArgs E) {
   try {
	 Response.Redirect("course.aspx");
   }
   catch (System.Exception e){
        ErrorHandler(e.ToString());
   }  
}

private void SubmitBtn_Click(Object Sender, EventArgs E) {
   try {
	if (!Page.IsValid)
           return ;
	SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["edu"]);; 
	string updateCmd = "update course set   course_name= @course_name"
						+", course_english_name=@course_english_name"
						+", course_alias=@course_alias"
						+", total_hour=@total_hour"
						+", amount=@amount"
						+", course_catalog_id=@course_catalog_id"
			     +" where course_id =@course_id";
	SqlCommand myCommand = new SqlCommand(updateCmd, myConnection);
	myCommand.Parameters.Add(new SqlParameter("@course_id", SqlDbType.VarChar, 50));
	myCommand.Parameters["@course_id"].Value = course_id.Text;        
	myCommand.Parameters.Add(new SqlParameter("@course_name", SqlDbType.VarChar, 100));
	myCommand.Parameters["@course_name"].Value = course_name.Text;     
	myCommand.Parameters.Add(new SqlParameter("@course_english_name", SqlDbType.VarChar, 100));
	myCommand.Parameters["@course_english_name"].Value = course_english_name.Text; 
	myCommand.Parameters.Add(new SqlParameter("@course_alias", SqlDbType.VarChar, 50));
	myCommand.Parameters["@course_alias"].Value = course_alias.Text;     
	myCommand.Parameters.Add(new SqlParameter("@total_hour", SqlDbType.Decimal, 5));
	myCommand.Parameters["@total_hour"].Value = total_hour.Text;
	myCommand.Parameters.Add(new SqlParameter("@amount", SqlDbType.Money, 8));
	myCommand.Parameters["@amount"].Value = amount.Text;
	myCommand.Parameters.Add(new SqlParameter("@course_catalog_id", SqlDbType.VarChar, 50));
	myCommand.Parameters["@course_catalog_id"].Value =  course_catalog_list.SelectedItem.Value;  

	myConnection.Open();

	try {
	   myCommand.ExecuteNonQuery();
	   MessageSQLUptDone();
	}
        catch (System.Data.SqlClient.SqlException e) {
	   SQLErrorHandler(e);
	}
	myConnection.Close();
   }
   catch (System.Exception e){
        ErrorHandler(e.ToString());
   }  
}

</script>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<!-- #include virtual="/include/header.inc" -->

<table width=100% cellspacing=0 cellpadding=0>
<tr>
   <td align="center" class="CONTENTTITLE" width="100%" bgcolor="D3C9C7">                        
              科目基本数据 
   </td>
</tr>
<tr>
   <td>	
      <span id="Message" EnableViewState="false" class="MESSAGE" runat="server"/>
   </td>	
</tr>

</table>
 <form runat="server" ACTION="course_upt.aspx" NAME="course_upt" METHOD="post">     
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
	<TR>
         <p>

 	  <div style="padding:15,15,15,15;font-size:10pt;font-family:Verdana">
         <TD VALIGN="top" ALIGN="left"><span class="REQUIREDFIELD">科目代码:</span>
	 <TD VALIGN="top" ALIGN="left">
		<asp:label id="course_id" runat="server"/></b>
	<TR style="background-color:#E7E7E7;">
          <TD VALIGN="center" ALIGN="left"><span class="REQUIREDFIELD">科目名称: </span><TD VALIGN="top" ALIGN="left"></b><asp:textbox type="text" id="course_name" Width="400px"  runat="server"/>
	  <asp:RequiredFieldValidator ControlToValidate="course_name" Display="Dynamic" ErrorMessage="*:不可空白" runat=server/>
	<TR >
          <TD VALIGN="center" ALIGN="left"><span class="FIELD">科目英文名称: </span><TD VALIGN="top" ALIGN="left"></b><asp:textbox type="text" id="course_english_name" Width="400px"  runat="server"/>
	<TR style="background-color:#E7E7E7;">
          <TD VALIGN="center" ALIGN="left"><span class="FIELD">科目简称: </span><TD VALIGN="top" ALIGN="left"></b><asp:textbox type="text" id="course_alias" Width="400px"  runat="server"/>
	<TR >
          <TD VALIGN="center" ALIGN="left"><span class="REQUIREDFIELD">总时数: </span><TD VALIGN="top" ALIGN="left"></b><asp:textbox type="text" id="total_hour" Width="400px"  runat="server"/>
	  <asp:RangeValidator id="rangeVal_total_hour" Type="Integer" ControlToValidate="total_hour" MinimumValue="0" MaximumValue="1000000000"   ErrorMessage="输入格式不符" runat="server"/>
	  <asp:RequiredFieldValidator ControlToValidate="total_hour" Display="Dynamic" ErrorMessage="*:不可空白" runat=server/>
	
	<TR style="background-color:#E7E7E7;">
          <TD VALIGN="center" ALIGN="left"><span class="REQUIREDFIELD">定价: </span><TD VALIGN="top" ALIGN="left"></b><asp:textbox type="text" id="amount" Width="400px"  runat="server"/>
  	  <asp:RangeValidator id="rangeVal" Type="Currency" ControlToValidate="amount" MinimumValue="0" MaximumValue="1000000000"   ErrorMessage="输入格式不符" runat="server"/>
	  <asp:RequiredFieldValidator ControlToValidate="amount" Display="Dynamic" ErrorMessage="*:不可空白" runat=server/>

	<TR >
          <TD VALIGN="center" ALIGN="left"><span class="REQUIREDFIELD">科目分类: </span><TD VALIGN="top" ALIGN="left"></b>
	  <asp:textbox type="text" id="course_catalog_id"  Visible="False" Width="100px"  runat="server"/>
 	  <asp:DropDownList id="course_catalog_list" runat="server" DataTextField="course_catalog_name" DataValueField="course_catalog_id"  />

	<TR>
	 <TD VALIGN="center" ALIGN="left"> <asp:Button OnClick="SubmitBtn_Click" Text="储存修改" Runat="server"/>
	 <TD VALIGN="center" ALIGN="left"> <asp:LinkButton OnClick="BackBtn_Click" Text="回科目基本数据维护" Runat="server"/>
        </div>  
</TABLE>

</form>
<!-- #include virtual="/include/footer.inc" -->
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -