我是asp.net的Oracle技术顾问,新手。
如何将Oracle Procedure的clob输出转换为.net应用程序形式的字符串?
下面是代码,该代码对于Oracle Varchar2字符串c#正常工作。
using System;
using System.Windows.Forms;
using System.Xml;
using System.Net;
using System.IO;
using Oracle.ManagedDataAccess.Client;
using System.Net.Mail;
using System.Configuration;
public void SoapRequest_api(string mode1)
{
OracleConnection con = new OracleConnection(ConfigurationManager.ConnectionStrings["Mobile"].ConnectionString);
OracleCommand cmd = new OracleCommand();
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "APPS.P_SOAP_WEBSERVICE.xxstatistics_p";
OracleParameter soap_request = new OracleParameter(":P_xml", OracleDbType.Clob);
soap_request.Direction = System.Data.ParameterDirection.Output;
OracleParameter msg = new OracleParameter(":p_msg", OracleDbType.Varchar2, 200);
msg.Direction = System.Data.ParameterDirection.Output;
OracleParameter refno = new OracleParameter(":p_SitRefNo", OracleDbType.Varchar2, 200);
refno.Direction = System.Data.ParameterDirection.Output;
OracleParameter mode = new OracleParameter(":p_SitTransCode", OracleDbType.Varchar2, 200);
mode.Value = mode1;
cmd.Parameters.Add(mode);
cmd.Parameters.Add(soap_request);
cmd.Parameters.Add(msg);
cmd.Parameters.Add(refno);
cmd.Connection = con;
con.Open();
try
{
int res = cmd.ExecuteNonQuery();
string status = msg.Value.ToString();
string refno_output = refno.Value.ToString();
con.Close();
if (status == "S")
{
string output = System.Convert.ToString(soap_request.Value);
this.textBox2.Text = refno_output;
SOAP_Request(Convert.ToString(soap_request.Value));
}
else
{
//curuser = null;
//return false;
}
MessageBox.Show(refno.Value.ToString()+"->"+ System.Convert.ToString(soap_request.Value));
}
catch (OracleException ex)
{
string temp = ex.Message;
con.Close();
}
}