Groups | Blog | Home
all groups > sql server reporting services > june 2005 >

sql server reporting services : Saving ParameterValue Object To SQL Table



JB
6/16/2005 12:28:16 PM
Greetings,
I am trying to store/retrieve given RS report's ParameterValue object to a
SQL table (ntext?)…I’ve tried MemoryStream w/ BinaryFormatter and am getting
“Not marked as serializable” errors. Any suggestions on a viable way to do
this would be appreciated.

Thank you for your time!
John
JB
6/21/2005 6:19:01 AM
I solved my problem using the XmlSerializer object as followings…


Public Shared Function Deserialize(ByVal bytes() As Byte) As Object
Dim xs As New XmlSerializer(GetType(ParameterValue()))
Dim ms As New MemoryStream(bytes)
Dim obj As Object
Try
obj = xs.Deserialize(ms)
Catch ex As Exception
Throw ex
End Try
Return obj
End Function

Public Shared Function Serialize(ByVal Obj() As Object) As Byte()

Dim xs As New XmlSerializer(GetType(ParameterValue()))
Dim Ms As New MemoryStream

Try
xs.Serialize(Ms, Obj)

Catch ex As Exception
Throw ex
End Try
Return Ms.ToArray
End Function

Dim Rp() as ParameterValue
‘Store parameter object
DataRow(“MyBinaryField”) = Serialize(Rp())

‘Get Stored Parameter object
Rp = Deserialize(DataRow(“MyBinaryField”))


[quoted text, click to view]
AddThis Social Bookmark Button