我正在尝试从使用旧版本的非托管oracle客户端的旧经典asp vb应用程序迁移以下内容,并执行.GetXML调用,该调用似乎传递了分页参数。
然而,在尝试使用网络ODP.NET管理的nuget包时,似乎没有直接转换?有谁知道我错过了什么?
OraDynaset.XMLRowTag = "row"
' OraDynaset.XMLEncodingTag = "UTF-8"
OraDynaset.XMLEncodingTag = "iso-8859-1"
OraDynaset.XMLNullIndicator = True
XMLdata = OraDynaset.GetXML(clng(posStart), clng(count))
If OraDatabase.LastServerErr <> 0 Then
Session("OraXMLError") = OraDatabase.LastServerErrText
Session("OraXMLErrorSQL") = QrySQL
Response.end
End If
以下是新项目
using (var connection = new OracleConnection(this.connectionStringFactory.GetConnectionString()))
{
connection.Open();
using (var cmd = connection.CreateCommand())
{
AddParameters(cmd, parameters);
cmd.CommandText = sqlQuery;
cmd.CommandType = CommandType.Text;
cmd.BindByName = true;
cmd.XmlCommandType = OracleXmlCommandType.Query;
cmd.XmlQueryProperties.RowTag = "row";
cmd.XmlQueryProperties.RootTag = "rows";
cmd.XmlQueryProperties.MaxRows = -1;
using (var reader = cmd.ExecuteXmlReader())
{
return XDocument.Load(reader, LoadOptions.PreserveWhitespace);
}
}
}