本帖最后由 oracle_web 于 2012-12-12 17:21:01 编辑

解决方案 »

  1.   

    没明白,那个数组是存储过程所有的参数?
    我的存储过程是只传进一个参数:国家名
    返回一个自定义的record类型(要求一定是这样)
    我想知道c#里怎么接record里的东西呢?参数没有这种类型啊!
      

  2.   

    不过仔细看了你这个存储过程,只是一个查询而已,不用写存储过程吧。你这个存储过程应该是编译都不通过的。
    直接执行sql语句返回datatable吧。
    参考
      

  3.   

    sql语句这样写:
    string sql =string.Format(@" select COUNTRY_NAME,LOCATION,CAPITOL,POPULATION,AIRPORTS,CLIMATE   from WF_COUNTRIES  where WF_COUNTRIES.COUNTRY_NAME= {0} ","参数");
    直接运行。
      

  4.   

    编译是通过的,这是老师要求写的存储过程。
    1.
    Create a procedure called country_demographics to display specific information about a country.
    Pass COUNTRY_NAME as an IN parameter. Display COUNTRY_NAME, LOCATION, CAPITOL, POPULATION, AIRPORTS, CLIMATE. Use a user-defined record structure for the INTO clause of your select statement. Raise an exception if the country does not exist.
    Hints:
    In order to populate the record in the select statement without specifying the record components, the record structure must be identical to the column list on the select statement.
      

  5.   

    string str="存储过程名字";
    sqlconnection conn=new sqlconnection(server=.;database=数据库名字;loginid='';loginpwd='');
    sqlcommand cmd=new sqlcommand(str,conn);
    cmd.commandtype=commandtype.procdure;
    conn.open();
      

  6.   

    存储过程不是我写的,我重新看了一下traveler_assistance_package的要求,它有很多个存储过程,上面是第一个,并不要求返回的是自定义的record类型,只要into就行。我又定义了一些out参数来读record的内容,已经写出来了。(感谢forrest23!)
    下面这个存储过程是需要把record作为out parameter的。如果我一样那么写,那输出类型不就不是record了?还是得解决这个问题啊!
    Create a procedure called find_region_and_currency to fetch and return the currency and region in which a country is located.
    Pass COUNTRY_NAME as an IN parameter and use a user-defined record as an OUT parameter that returns the country name, its region and currency.
    Hints:
    Declare a user-defined record TYPE in the package spec with appropriate components. Use this record type to declare record variables in your procedure.
      

  7.   

    目测华师大软院
    我写的调用是:string connStr = "Data Source=orcl;user id=scott;password=sun";
    OracleConnection conn = new OracleConnection(connStr);
    conn.Open();
    cmd = new OracleCommand("traveler_assistance_package.country_demographics ",conn);
    cmd.CommandType  = CommandType.StoredProcedure;