Covert.toint(textBox3.Text.toString().trim())

解决方案 »

  1.   

    sorry 我看错了上面的我说的不对
    首先你的查询在oralce 数据库里面定义游标才可以的查询的
    (1)创建一个包,含有一个游标类型:(一个数据库中只需作一次)CREATE OR REPLACE PACKAGE Test
      AS
           TYPE Test_CURSOR IS REF CURSOR;
    END Test;(2)过程:CREATE OR REPLACE PROCEDURE GetCategoryBooks
    (
         p_CURSOR out Test.Test_CURSOR,    -- 这里是上面包中的类型,输出参数
         p_CatogoryID INTEGER
    )
    AS
    BEGIN
         OPEN p_CURSOR FOR
               SELECT * FROM Books
               WHERE CategoryID=p_CatogoryID;
    END GetCategoryBooks;
    (3).NET 程序中:OracleParameters parameters = {
         new OracleParameter("p_CURSOR", OracleType.CURSOR, 2000, ParameterDirection.Output, true, 0, 0, "",
              DataRowVersion.Default, Convert.DBNull),
         new OracleParameter("p_CatogoryID", OracleType.Int32)
    };parameters[1].Value = 22;OracleConnection connection = new OracleConnection( ConnectionString );
    OracleCommand command = new OracleCommand("GetCategoryBooks", connection);
    command.CommandType = CommandType.StoredProcedure;foreach(OracleParameter parameter in parameters)
         command.Parameters.Add( parameter );connection.Open();
    OracleDataReader dr = command.ExecuteReader();while(dr.Read())
    {
        // 你的具体操作。这个就不需要我教吧?
    }
    connection.Close();
      

  2.   

    不用定义游标,你太粗心了,在参数iDeptNO后面多了一个空格,去掉空格就行cmd.Parameters.Add(new OracleParameter("iDeptNO ",OracleType.Number,2,"DEPTNO"));