2011-11-15 36 views
3

私はASP.NET 3.5を使用しています。私は、ユーザーがボタンをクリックすると、そのページ上に情報がある別のページを描くことになっているというフォームを作った。System.NotImplementedExceptionエラー

The method or operation is not implemented. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NotImplementedException: The method or operation is not implemented. 

Source Error: 

    public static dsPersonnel GetPersonnel(string p) 
    { 
     throw new NotImplementedException(); 
    } 

Source File: Line: 203 

私は助けのための十分な情報を与えるためにここに投稿する必要があるだろうか、すべてはよく分からない。その代わりロードの私は、このエラーページを取得します。

エラーが発生する可能性があるコードを次に示します。このエラーは、あなたがロードしているページがロード・プロセス中にそのコードによってアクセスされるGetPersonnelメソッドを実装していないことを意味

public clsDataLayer() 
    { 

    } 

    // This function gets the user activity from the tblPersonnel 
    public static dsPersonnel GetPersonnel(string Database, string strSearch) 
    { 
     dsPersonnel DS; 
     OleDbConnection sqlConn; 
     OleDbDataAdapter sqlDA; 

     //create the connection string 
     sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + 
     "Data Source=" + Database); 

     string query; 
     if (strSearch == "" || strSearch.Trim().Length == 0) 
     { 
      query = "SELECT * from tblPersonnel"; 
     } 
     else 
     { 
      query = "select * from tblPersonnel where LastName = '" + strSearch + "'"; 
     } 


     // Defines sqlDA and what each will consist of 
     sqlDA = new OleDbDataAdapter("select * from tblPersonnel", sqlConn); 

     // Defines DS and what each will consist of 
     DS = new dsPersonnel(); 

     // Outputs the results from the information gathered 
     sqlDA.Fill(DS.tblPersonnel); 

     // Starts over for a new user 
     return DS; 
    } 

    // This function saves the user activity 
    public static void SavePersonnel(string Database, string FormAccessed) 
    { 
     // Defines the connection to the database 
     OleDbConnection conn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" + 
      "Data Source=" + Database); 
     conn.Open(); 
     OleDbCommand command = conn.CreateCommand(); 
     string strSQL; 

     strSQL = "Insert into tblPersonnel (UserIP, FormAccessed) values ('" + 
      GetIP4Address() + "', '" + FormAccessed + "')"; 

     command.CommandType = CommandType.Text; 
     command.CommandText = strSQL; 
     command.ExecuteNonQuery(); 
     conn.Close(); 

    } 

    public static dsPersonnel GetPersonnel(string p) 
    { 
     throw new NotImplementedException(); 
    } 
} 
+0

GetPersonnelメソッドを実装しましたか?スタブは、実際にメソッドを実装するまで、デフォルトでNotImplementedExceptionをスローします。 – Brandon

答えて

8

あなたが(それはクラスライブラリのメソッドではありません考慮して)呼び出している具体的な方法は、おそらくこれを具体的に実行する以上のものです:

throw new NotImplementedException(); 

それは今のスタブです。これはあなたのソリューションのコードです。あなたのページでは、あなたのメソッドは実装されていない可能性があります。

1

:私は、私は場違いなものを持っているかもしれないと思います。私はあなたが読み込まれているページのソースを確認し、このメソッドを実装する必要がありますと思う。

0

エラーとはまったく同じです。実装されていない例外を投げているコード行があります。ここをクリックしてください:

行201:public static dsPersonnel GetPersonnel(string p)行202:{行203:throw new NotImplementedException();行204:}行205:}

2

GetPersonnel()メソッドは、コード内にNotImplementedException行を挿入するVisual Studioの自動コード生成手法を使用して追加している可能性があります。手動で削除する必要があります。

GetPersonnel()メソッド内では、throw new NotImplementedException ...行を削除し、メソッドの戻り値の型に一致する値を返すようにメソッドを完全に実装します。

+1

私は元の質問に上記のコードを掲載しました。メソッドを実装すると言っています。私はそれがすでにあると思う。私がthrowする新しいNotImplementedException()ステートメントを削除する場合、私は他の多くのエラーが発生します。だから、私は何かを振り回したと思うのですか? – Mike

+0

オーバーロードされたメソッドの1つが実装されていないため、ページの読み込み中に呼び出される可能性があります。実装してください。 – VS1

関連する問題