Monday, March 12, 2012

How to Handle Oracles XMLElement output in VS.NET 2005

Hi,

Oracle 9i, VS.NET 2005

I have a query that uses Oracle's XMLElement function. It returns XML. What I don't know, is how I use VS.NET to handle the outupt. I just want to take this output and write it to a file. Has anyone done this before? How is this accomplished?

I'm trying something like this but I've no idea if this is correct or not:

// connect to oracle

OracleConnection oConn =newOracleConnection("Data Source=databasename;Persist Security Info=True;User ID=userid;Password=pwd");OracleCommand oCommand = oConn.CreateCommand();

oCommand.CommandText =

"SELECT XMLElement( a huge multiline, multi join statement.....";

oCommand.CommandType =

CommandType.Text;

oConn.Open();

// retrieve the output.OracleDataReader oread = oCommand.ExecuteReader();

while (oread.Read())

{

Response.Write(oread.GetString(0) + "<br />" );

}

oread.Close();

oConn.Close();

The query runs in SQLPlus.

However, I'm slightly mystified as to what to use to handle the output from Oracle's XMLElement. Should I use an OracleDataReader?

Thanks in advance,

Paul

Hi,

I think you can return as a string to the c# code in the form XML string.Then use XMLDOM object loadXML(XML string) method so that you get dom object with xml data then if wanted to load it into dataset use DOM object's DOM.dataset() method.

It may help you out

Labels: , , , , , , , , , , ,

how to handle bulk data in gridview

HI

I am having a gridview in a web application. for a search my stored procedure returns more than 30 thousands of records sometimes.

I am not using any direct connection from gridview to databse. i am fill the dataset by executing the stored procedure. If it's a direct connection it will bring few records to fill the first few pages and once we navigate , it will bring another set of data. (my page size is 1000).

how can i handle this? is there anyway to bring few data to dataset and once we navigate to another page we can bring next few 1000s records?

Regards

K.Anvar sadath

Hi Anvar,

You need to use custom paging in Gridview. Please check out this article:

http://aspnet.4guysfromrolla.com/articles/031506-1.aspx

Hope this helps.

Labels: , , , , , , , , , , , ,