开发者

no suitable method found to override error on Asp.net

I am new to asp.net. I wrote one page of asp.net, but when I run it, I get the following errors.

 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 = "&开发者_开发问答quot;;
    txtddate.Text = "";
}
}

Description:

An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message:

CS0115: 'ASP.issue_of_book_aspx.GetTypeHashCode()': no suitable method found to override

Source Error:

Line 1253:        
Line 1254:        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
Line 1255:        public override int GetTypeHashCode() {
Line 1256:            return -853658727;
Line 1257:        }

Will anyone will guide me? Thank you.


Check this article it may help you

http://technage.blogspot.com/2008/05/error-gettypehashcode-no-suitable.html

As per my observation your inherit name means issue_of_book_aspx.cs and in your code you display name as Issueofbook so this vary's and raise an error make sure your .aspx and .aspx.cs name should be the same

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜