Click here to Skip to main content
15,917,174 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got Error Like

The method or operation is not implemented.



Line 23: private void BindRepeaterData()
Line 24: {
Line 25: throw new NotImplementedException();
Line 26: }
Line 27:



This is my code Below ......

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace WebApplication1
{
public partial class WebForm2 : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("Data Source=BLUEBIRDS-LAP;Initial Catalog=Sample;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindRepeaterData();
}
}

private void BindRepeaterData()
{
throw new NotImplementedException();
}



protected void btnSubmit_Click(object sender, EventArgs e)
{

con.Open();
SqlCommand cmd = new SqlCommand("insert into Repeter_Table (UserName,Subject,Comment,PostedDate) values(@userName,@subject,@comment,@postedDate)", con);
cmd.Parameters.AddWithValue("@userName", txtName.Text);
cmd.Parameters.AddWithValue("@subject", txtSubject.Text);
cmd.Parameters.AddWithValue("@comment", txtComment.Text);
cmd.Parameters.AddWithValue("@postedDate", DateTime.Now);
cmd.ExecuteNonQuery();
con.Close();
txtName.Text = string.Empty;
txtSubject.Text = string.Empty;
txtComment.Text = string.Empty;
BindRepeaterData();
}


protected void RepDetails_ItemCommand(object source, RepeaterCommandEventArgs e)
{
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from Repeter_Table Order By PostedDate desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
RepDetails.DataSource = ds;
RepDetails.DataBind();
con.Close();
}
}
}
}


Thanks For Your Help..
Posted
Comments
Timberbird 21-Oct-13 4:12am    
And what is the problem? Apparently Visual Studio (or one of its extensions) generated a code for you, including a stub for BindRepeaterData() method. This metods explicitly generates an exception of specific type, which just shouts: "You haven't implemented this method, you must put some code in it and remove 'throw exception' lines!" So what you need to do now is to write the actual code in BindRepeaterData(). You know what this method must do, right?

1 solution

Visual studio adds the line:
C#
throw new NotImplementedException();
When it automatically creates a method for you, allowing you to have a marker that there is some work you have to do. If you forget, then the exception is thrown when you run your code, and this serves as a warning that your code probably won't work - because you haven't written it!

Remove the line, and fill in the code to perform the function the method is there for!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900