找不到合适的方法覆盖Asp.net上的错误
我是asp.net新手。我写了一页asp.net,但是当我运行它时,我得到了以下错误找不到合适的方法覆盖Asp.net上的错误,asp.net,Asp.net,我是asp.net新手。我写了一页asp.net,但是当我运行它时,我得到了以下错误 public partial class Issueofbook: System.Web.UI.Page { public Int64 Sid; protected void Page_Load(object sender, EventArgs e) { string Id; Id = Request.QueryString.Get(0); if (!(IsPostBack ==
public partial class Issueofbook: System.Web.UI.Page
{
public Int64 Sid;
protected void Page_Load(object sender, EventArgs e)
{
string Id;
Id = Request.QueryString.Get(0);
if (!(IsPostBack == true))
{
if (Request.QueryString.Get(1) == "G")
{
Sid = Convert.ToInt64(Id);
if (PopulatedRecord (Sid ) == false)
{
}
}
}
}
private Boolean PopulatedRecord(Int64 Id)
{
DataSet DS;
DS = new DataSet();
SqlCommand cmd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter();
SqlConnection Cnn = new SqlConnection();
string connectionstring;
connectionstring = @"Datasource=DEVI\SQLEXPRESS;Intial catalog=librarymanagement;Integrated Security=SSPI";
Cnn.ConnectionString = connectionstring;
if (Cnn.State != ConnectionState.Open)
Cnn.Open();
cmd.Connection = Cnn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "usbinsertdatainto";
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@bookno", "no");
Adp.SelectCommand = Cmd;
try
{
Adp.Fill(Ds);
}
catch (Exception ex)
{
throw new ApplicationException(
"!!! An Error Occured While Update Record In Dtl_SecurityCapital_Upload." + ex.Message);
lblError.Visible = true;
lblError.Text = "!!! An Error Occured While " + ex.Message.ToString();
return false;
}
if (DS.Tables[0].Rows.Count > 0)
{
txtno.Text = DS.Tables[0].Rows[0]["bookno"].ToString();
txtstuno.Text = DS.Tables[0].Rows[0]["studentno"].ToString();
RadioButton1.Text = DS.Tables[0].Rows[0]["currentnoofcopiesavaillable"].ToString();
RadioButton2.Text = DS.Tables[0].Rows[0]["currentnoofcopiesavaillable"].ToString();
txtdate.Text = DS.Tables[0].Rows[0]["IssueDate"].ToString();
txtddate.Text = DS.Tables[0].Rows[0]["Duedate"].ToString();
}
cmd.Dispose();
Cnn.Close();
Cnn.Dispose();
return true;
}
protected void Button2_Click(object sender, EventArgs e)
{
SqlConnection Cnn = new SqlConnection();
string constr = null;
SqlCommand cmd = new SqlCommand();
constr = @"Data Source=DEVI\SQLEXPRESS; Initial Catalog =librarymanagement; Integrated Security=SSPI";
Cnn.ConnectionString =constr;
try
{
if (Cnn.State != ConnectionState.Open)
Cnn.Open();
}
catch (Exception ex)
{
string str1 = null;
str1 = ex.ToString();
}
cmd.Connection = Cnn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "uspInsertbookDatainto";
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@bookno", txtno.Text);
cmd.Parameters.AddWithValue("@studentno", txtstuno.Text);
cmd.Parameters.AddWithValue("@Issuedate", txtdate.Text);
cmd.Parameters.AddWithValue("@Duedate", txtddate.Text);
if (RadioButton1.Checked==true)
{
cmd.Parameters.AddWithValue("@currentnoofcopiesavaillable", RadioButton1.Text);
}
if (RadioButton2.Checked == true)
{
cmd.Parameters.AddWithValue("@currentnoofcopiesavaillable", RadioButton2.Text);
}
try
{
cmd.ExecuteNonquery();
}
catch (Exception ex)
{
throw new ApplicationException("!!! An error an occured while Insert Record Dtl_SecurityCapital_Upload." + ex.Message);
lblerror.Visible = true;
lblerror.Text = "!!! An Error occured while ." + ex.Message.ToString();
}
finally
{
cmd.Dispose();
}
Cnn.Close();
lblError.Text = "New Issue of record suceessfully!!";
txtno.Text = "";
txtstuno.Text = "";
txtdate.Text = "";
txtddate.Text = "";
}
}
说明:
编译服务此请求所需的资源时出错。请查看以下特定错误详细信息,并适当修改源代码
编译器错误消息:
源错误:
有人会指引我吗?谢谢。查看这篇文章,它可能会对您有所帮助
根据我的观察,您的继承名称意味着issue\u of_book\u aspx.cs,在您的代码中,您将名称显示为Issueofbook,因此这会发生变化并引发错误。请确保您的.aspx和.aspx.cs名称应相同。检查本文,它可能会对您有所帮助
根据我的观察,您的inherit name意味着issue of_book_aspx.cs,在您的代码中,您将名称显示为Issueofbook,因此这会发生变化并引发错误。请确保您的.aspx和.aspx.cs名称应相同没有任何示例代码,我们无法判断问题所在is@Dorababu我加上我的代码,你会检查出你不是吗重写此代码中的方法。但是,它是一个分部类,您可以在GetTypeHashCode上搜索并检查它是否在其他文件中被重写,该文件也是此类吗?我知道它应该是一个分部类,因为它是一个aspx代码隐藏文件,但最好确保它不是在其他地方意外使用的?您的代码似乎没有任何覆盖,所以您可以提供完整的堆栈跟踪。。。我们将看到错误是从何处产生的。看到这一点,您的页面被定义为Issueofbook,并从源代码中检查您给出的名称。发布设计部分。请提供任何示例代码。我们无法判断问题所在is@Dorababu我添加了我的代码,你会发现你没有重写代码中的方法。但是,它是一个分部类,您可以在GetTypeHashCode上搜索并检查它是否在其他文件中被重写,该文件也是此类吗?我知道它应该是一个分部类,因为它是一个aspx代码隐藏文件,但最好确保它不是在其他地方意外使用的?您的代码似乎没有任何覆盖,所以您可以提供完整的堆栈跟踪。。。我们将看到错误是从哪里产生的。请查看您的页面被定义为Issueofbook,并从源代码中检查您给出的名称。请张贴设计部分
CS0115: 'ASP.issue_of_book_aspx.GetTypeHashCode()': no suitable method found to override
Line 1253:
Line 1254: [System.Diagnostics.DebuggerNonUserCodeAttribute()]
Line 1255: public override int GetTypeHashCode() {
Line 1256: return -853658727;
Line 1257: }