日期:2014-05-17 浏览次数:20547 次
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> </form> </body> </html>
------解决方案--------------------
if (result !=0)
{
Response.Write("<script>location.href='nextstep.aspx?type='+confirm('该学生此学科成绩已存在,是否覆盖此成绩?');</script");
}
'nextstep.aspx页面里面
Page_Load:
if(Request.QueryString["type"]=="true")
{
mySQL = "update UTB_SCHOOL_SCORE set LessonID=@LessonID,StudentID=@StudentID,Score=@Score where ID=@ID";
con = new SqlConnection(@"server=localhost;uid=sa;pwd=;database=schooldemo");
com = new SqlCommand(mySQL, con);
}
大致的意思是这样的,你也可以封装在一个页面中