日期:2014-05-18  浏览次数:20917 次

C#操作ORACLE 的XML问题
在SQL中,执行一条SQL语句会返回到XML中,在ORACLE中就没有这个功能了.

private XmlReader GetParameters()
{
String sqlStr = "SELECT B.[name], C.[name] AS [type], B.length, B.isoutparam, B.isnullable";
sqlStr += " FROM sysobjects AS A INNER JOIN";
sqlStr += " syscolumns AS B ON A.id = B.id AND A.xtype = 'P' AND A.name = '" + _Procedure + "' INNER JOIN";
sqlStr += " systypes C ON B.xtype = C.xtype AND C.[name] <> 'sysname'";
sqlStr += " ORDER BY ROW_NUMBER() OVER (ORDER BY B.id), B.isoutparam";
sqlStr += " FOR XML RAW";
OracleCommand sqlCmd = new OracleCommand(sqlStr, _SqlConnection);
// <row name="Action" type="varchar" length="50" isoutparam="0" isnullable="1" />
XmlReader sqlXmlReader = null;
try
{
   
sqlXmlReader = sqlCmd.ExecuteXmlReader(); //没有这个方法了ExecuteXmlReader();  
   
   
   
}
catch (Exception ex)
{
if (sqlXmlReader != null) sqlXmlReader.Close();
sqlXmlReader = null;
_LastError = "get parameters error: " + ex.Message;
}
finally
{
sqlCmd.Dispose();
sqlCmd = null;
}
return sqlXmlReader;
}
请高手指点迷津.

------解决方案--------------------
用过一次,全部读出来,改了以后再全部存回去