0

私は次のように手順を書きました

CREATE OR REPLACE PROCEDURE proc_ss(cName IN PayRoll.Name%VARCHAR2(50)   
)
IS
BEGIN 
 insert into employees(Name) values(cName);
END;

sql plusを介していくつかのコンパイルエラーで実行されました。

この手順にアクセスするための私のC#コードは

OdbcCommand cmdupd = new OdbcCommand("{call proc_ss(?)}", con);    
            cmdupd.CommandType = CommandType.StoredProcedure;
            cmdupd.Parameters.Add("Name", OdbcType.VarChar, 50).Value = Name;           
            cmdupd.ExecuteNonQuery();
            cmdupd.Dispose();

上記のクエリを実行しているときに、次のようなエラーが発生します

System.data.odbcexception as:

ERROR [NA000] [Microsoft][ODBC driver for Oracle][Oracle]ORA-20003:
ERROR [42000] [Microsoft][ODBC driver for Oracle]Syntax error or access violation

Stack Trace as:

   at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
   at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)
   at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
   at System.Data.Odbc.OdbcCommand.ExecuteNonQuery()
   at payroll.BusinessAccessLayer.updating(Int32 id, String Name, String Phone, String Email, String Designation, String LevelID, String Username, String Password) in e:\payrollmanagement-oracle\source\Payroll\App_Code\BusinessAccessLayer.cs:line 103
   at employees.gridEmployees_RowUpdating(Object sender, GridViewUpdateEventArgs e) in e:\payrollmanagement-oracle\source\Payroll\employees.aspx.cs:line 118
   at System.Web.UI.WebControls.GridView.OnRowUpdating(GridViewUpdateEventArgs e)
   at System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation)
   at System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)
   at System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e)
   at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

どこに引っかかったのかわからない…!

貴重なご意見・ご感想をお待ちしております..

4

1 に答える 1

1

command Nameproc_ss で調整します

OdbcCommand cmdupd = new OdbcCommand("{ CALL proc_ss(?) }", con);  

また、パラメータも調整します

 cmdupd.Parameters.Add("@cName", OdbcType.VarChar, 50).Value = Name;   
于 2012-09-18T14:48:25.237 に答える