-6

I would like to know, why did the NotImplementedException(); still appear even though I'm pretty sure that I have called the method?

this is the throw exception in my dsNBC.xsd designer:

internal int getLastIDbyMaxPeg()
{
    throw new System.NotImplementedException();
}

and this is how I called the method in PegawaiControl.cs in a folder named Control :

public int getNumID()
{
     return Peg.getLastIDbyMaxPeg();
}

public string generateIDPeg()
{
    string id = "PEG";
    return id + Convert.ToString(getNumID() + 1);
}

and in the boundary layout I just called the generateIDPeg() into a local variable like this : string idPegw = PC.generateIDPeg();

Well, getLastIDbyMaxPeg() is a name of method in the query dataset of dsNBC.xsd that I created. So the actual implementation code for that method is the query in dataset. I got consufed here how can I implement the query as the actual implementation in the throw exception? You can see the StackTrace here

Can you help me?

RedPlay
  • 1
  • 1

2 Answers2

0

You have to remove that code and replace it with your actual implementation.
The method has not been implemented (i.e. made to actually do something, rather than throwing the NotImplementedException), only called.

It will not just automatically remove itself because you call the method, you must supply the implementation.

Place your logic inside of the method and remove the current line to fix your situation:

internal int getLastIDbyMaxPeg()
{
    //Do some things
    //return some int value
}
Broots Waymb
  • 4,713
  • 3
  • 28
  • 51
  • but the getLastIDbyMaxPeg() is a name of method that I create in a DataSet to find the last max id from the database so the code is the query... That's why there is a "Peg." in front of getLastIDbyMaxPeg() because Peg is the variable for the tableAdapter... how can I placed the code into the internal int getLastIDbyMaxPeg while the code itself is a query for dataset? @DangerZone – RedPlay Oct 07 '16 at 16:31
  • That's a different question entirely. You will need to research how to do queries in C# and place your query in this method. – Broots Waymb Oct 07 '16 at 17:44
0

You have, indeed, called the getLastIDbyMaxPeg() method, which is the source of your problem.

This exception means exactly what it says: you didn't implement the getLastIDbyMaxPeg() method before you called it. Right now all getLastIDbyMaxPeg does is throw a NotImplementedException(). (That exception is a standard "placeholder" for a method that needs to be implemented but hasn't been yet).

If you replace throw new NotImplementedException() with an actual implementation your problem will be fixed.