Transfer Stream of Recordset

H

Harvey Triana

Hello -
I am migrating a large COM system solution to ASP.NET

To transfer data from Web to client this application uses streams of ADO
recordset, example:

Clasic ASP (VB Script):
<%
Dim Rs ' Recordset of ADO
' populate recordset
...
Response.ContentType = "multipart/mixed"
Rs.Save Response, 0 '//adPersistADTG
Rs.Close
Set Rs = Nothing
%>

client (VB6) side consumes this Recorset as:

Dim rs As Recordset
Set rs = New ADODB.Recordset
rs.Open URL
....
' When URL is the asp page.
--
From ASP.NET i am trying:

using ADODB;
.....
public partial class RsSQL : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Recordset rs;
// populate recordset
...
Response.ContentType = "multipart/mixed";
rs.Save (Response, 0);
rs = null;
}

I get a HRESULT exeption in rs.Save (Response, 0)
Any suggestion?...

Thanks in advanced,
<HT />
 
G

Guest

Hello -
I am migrating a large COM system solution to ASP.NET

To transfer data from Web to client this application uses streams of ADO
recordset, example:

Clasic ASP (VB Script):
<%
Dim Rs ' Recordset of ADO
' populate recordset
...
Response.ContentType = "multipart/mixed"
Rs.Save Response, 0 '//adPersistADTG
Rs.Close
Set Rs = Nothing
%>

client (VB6) side consumes this Recorset as:

Dim rs As Recordset
Set rs = New ADODB.Recordset
rs.Open URL
....
' When URL is the asp page.
--
From ASP.NET i am trying:

using ADODB;
....
public partial class RsSQL : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Recordset rs;
// populate recordset
...
Response.ContentType = "multipart/mixed";
rs.Save (Response, 0);
rs = null;
}

I get a HRESULT exeption in rs.Save (Response, 0)
Any suggestion?...

Thanks in advanced,
<HT />

I would recommend to use ADO.NET

Migrating from ADO to ADO.NET
http://msdn.microsoft.com/msdnmag/issues/04/07/DataPoints/

Moving from ADO 2.5+to ADO.NET
http://www.ftponline.com/conferences/vslive/2002/or/chapters/VBXMLWSDevGuide_c05.pdf
 
H

Harvey Triana

Already i know that! Would not be asking. I said that is a huege solution,
with a huege code lines of ADO. I try to optimizing the Web client
iterface....
 
H

Harvey Triana

Hello Bromberg-

With Response.OutputStream I get the same error...
Maybe ASP Response is not the same or ASP.NET Response...
Thanks,
<Harvey Triana />
 
H

Harvey Triana

I try (looks fine):

Response.ContentType = "multipart/mixed";
Response.Clear();
Response.BufferOutput = true;
rs.Save(Response.OutputStream, ADODB.PersistFormatEnum.adPersistADTG);
Response.Flush();

The same, does not work!
-Is it possible transfer Recordset stream from ASP.NET?

<Harvey Triana />
 
G

Guest

Already i know that! Would not be asking.

Quote: "The ADODB.Recordset.Save method's adPersistXML option
generates a proprietary Microsoft XML Data-Reduced (XDR) rowset schema
and an attribute-centric representation of the Recordset's data. This
schema is obsolete, and use of attribute-centric XML to represent
rowsets is no longer a generally accepted programming practice."

Try ADO.NET. For example, the ADO.NET DataSet object. It has WriteXml
method that allow its contents to be exported to an XML file or
stream.

DataSet ds = new DataSet();
System.Data.OleDb.OleDbDataAdapter myDataAdapter = new
System.Data.OleDb.OleDbDataAdapter();
myDataAdapter.Fill(ds, rs);

this.Response.Clear();
this.Response.ContentType = "text/xml";
this.Response.Charset = "utf-8";

System.Xml.XmlWriter w = new
System.Xml.XmlTextWriter(this.Response.OutputStream,
System.Text.Encoding.UTF8);
System.Xml.XmlDataDocument d = new System.Xml.XmlDataDocument(ds);
d.DataSet.EnforceConstraints = false;
System.Xml.XmlDeclaration xmlDec = xmlDoc.CreateXmlDeclaration("1.0",
"UTF-8", null);
d.PrependChild(xmlDec);
d.WriteTo(w);
w.Flush();
w.Close();
 
H

Harvey Triana

I think that I get it:
// server snip ...
Stream s = new Stream();
s.Type = StreamTypeEnum.adTypeBinary;
// rs is a filled Recordset
rs.Save(s, PersistFormatEnum.adPersistADTG);
rs.Close();
// send to client
Response.ContentType = "multipart/mixed"; //"text/xml" to adPersistXML
Response.Clear();
Response.BufferOutput = true;
Response.BinaryWrite((byte[])s.Read(s.Size));
s.Close();
Response.Flush();
}
....
' The client (ActiveX VB6):
Private Sub RecordsetTest()
Dim rs As Recordset: Set rs = New Recordset
rs.Open "http://....something.aspx"
' work with Recordset data
' ...
End Sub

Thanks to Peter, Alexey.
<Harvey Triana />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top