J
Jaime Stuardo
Hi all...
I'm trying to retrieve a SQLXML query using VB.NET. When I programmed in VB
6.0, I used Stream object to accomplish this which was trivial.
I cannot do the same thing in VB.NET. Here the most similar object is the
OleDbDataReader. I have the following method, ¿is it correct what I am
doing? By doing oRdr.GetBytes(0, 0, bBytes, 0, 1000) I'm limiting only to
1000 bytes. How can I know the length of the stream?
Public Function get_Tree(Optional ByVal sEstado As String = "") As String
Dim oConn As New OleDbConnection(m_sConn)
oConn.Open()
Dim oCmd As New OleDbCommand("SP_GET_CATEGORY_TREE", oConn)
Dim oParamEst As OleDbParameter = New OleDbParameter("@CAT_EST",
OleDbType.VarChar, Len(sEstado))
oParamEst.Value = sEstado
oCmd.Parameters.Add(oParamEst)
oCmd.CommandType = CommandType.StoredProcedure
Dim oRdr As OleDbDataReader = oCmd.ExecuteReader
If oRdr.Read Then
Dim bBytes(1000) As Byte
oRdr.GetBytes(0, 0, bBytes, 0, 1000)
Return "" ' I NEED TO RETURN THE XML THAT IS RETURNED FROM
THE SQL SP (AS FOR XML AUTO)
End If
End Function
Any help will be greately appreciated,
Jaime
I'm trying to retrieve a SQLXML query using VB.NET. When I programmed in VB
6.0, I used Stream object to accomplish this which was trivial.
I cannot do the same thing in VB.NET. Here the most similar object is the
OleDbDataReader. I have the following method, ¿is it correct what I am
doing? By doing oRdr.GetBytes(0, 0, bBytes, 0, 1000) I'm limiting only to
1000 bytes. How can I know the length of the stream?
Public Function get_Tree(Optional ByVal sEstado As String = "") As String
Dim oConn As New OleDbConnection(m_sConn)
oConn.Open()
Dim oCmd As New OleDbCommand("SP_GET_CATEGORY_TREE", oConn)
Dim oParamEst As OleDbParameter = New OleDbParameter("@CAT_EST",
OleDbType.VarChar, Len(sEstado))
oParamEst.Value = sEstado
oCmd.Parameters.Add(oParamEst)
oCmd.CommandType = CommandType.StoredProcedure
Dim oRdr As OleDbDataReader = oCmd.ExecuteReader
If oRdr.Read Then
Dim bBytes(1000) As Byte
oRdr.GetBytes(0, 0, bBytes, 0, 1000)
Return "" ' I NEED TO RETURN THE XML THAT IS RETURNED FROM
THE SQL SP (AS FOR XML AUTO)
End If
End Function
Any help will be greately appreciated,
Jaime