473,545 Members | 2,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

serialize to SQL Server Blob instead of XML serialize

I've been experiencing problems on some computers with XML Serialization. On
some computers the files do not get created on the web server's hard drive
and it's been driving me nuts trying to figure it out.

I store navigation history and application state in object collections and
save this upon application exit by doing an XML.Serialize.

I'd like to serialize directly to SQL Server instead. Can I create a stream
object to be used by SQL Server with serialization?

Thanks
Nov 18 '05 #1
3 2016
Yeah, this is the basics (DT is just an object I'm taking from session and
serializing):

Dim ms As New MemoryStream
ms = SerializeDT(CTy pe(Session("DT" ), DTProcess))
Dim da() As Byte
da = ms.ToArray
cmd.Parameters( "@DesktopData") .Value = da
SqlConnection1. Open()
cmd.ExecuteNonQ uery()
SqlConnection1. Close()

Public Shared Function SerializeDT(ByV al DTSource As DTProcess) As
MemoryStream
Dim ms As New MemoryStream
Dim formatter As New BinaryFormatter
formatter.Seria lize(ms, DTSource)
ms.Position = 0
Return ms
End Function

-John Oakes
"Gordz" <jo*****@aol.co m> wrote in message
news:10******** ****@corp.super news.com...
I've been experiencing problems on some computers with XML Serialization. On some computers the files do not get created on the web server's hard drive
and it's been driving me nuts trying to figure it out.

I store navigation history and application state in object collections and
save this upon application exit by doing an XML.Serialize.

I'd like to serialize directly to SQL Server instead. Can I create a stream object to be used by SQL Server with serialization?

Thanks

Nov 18 '05 #2
thanks John.

I've never used binary objects in SQL before.

Where exactly is your data "@DesktopDa ta" stored in the database? Do you
have a field already defined?

Cheers,

Gord

"John Oakes" <jo**@nospam.ne tworkproduction s.net> wrote in message
news:Ow******** ********@TK2MSF TNGP12.phx.gbl. ..
Yeah, this is the basics (DT is just an object I'm taking from session and
serializing):

Dim ms As New MemoryStream
ms = SerializeDT(CTy pe(Session("DT" ), DTProcess))
Dim da() As Byte
da = ms.ToArray
cmd.Parameters( "@DesktopData") .Value = da
SqlConnection1. Open()
cmd.ExecuteNonQ uery()
SqlConnection1. Close()

Public Shared Function SerializeDT(ByV al DTSource As DTProcess) As
MemoryStream
Dim ms As New MemoryStream
Dim formatter As New BinaryFormatter
formatter.Seria lize(ms, DTSource)
ms.Position = 0
Return ms
End Function

-John Oakes
"Gordz" <jo*****@aol.co m> wrote in message
news:10******** ****@corp.super news.com...
I've been experiencing problems on some computers with XML Serialization. On some computers the files do not get created on the web server's hard drive
and it's been driving me nuts trying to figure it out.

I store navigation history and application state in object collections and
save this upon application exit by doing an XML.Serialize.

I'd like to serialize directly to SQL Server instead. Can I create a stream object to be used by SQL Server with serialization?

Thanks


Nov 18 '05 #3
Yes, I have a field defined. The datatype is image, which is
variable-length binary data from 0 through 231-1 (2,147,483,647) bytes.

-John Oakes
"Gordz" <jo*****@aol.co m> wrote in message
news:10******** *****@corp.supe rnews.com...
thanks John.

I've never used binary objects in SQL before.

Where exactly is your data "@DesktopDa ta" stored in the database? Do you
have a field already defined?

Cheers,

Gord

"John Oakes" <jo**@nospam.ne tworkproduction s.net> wrote in message
news:Ow******** ********@TK2MSF TNGP12.phx.gbl. ..
Yeah, this is the basics (DT is just an object I'm taking from session and
serializing):

Dim ms As New MemoryStream
ms = SerializeDT(CTy pe(Session("DT" ), DTProcess))
Dim da() As Byte
da = ms.ToArray
cmd.Parameters( "@DesktopData") .Value = da
SqlConnection1. Open()
cmd.ExecuteNonQ uery()
SqlConnection1. Close()

Public Shared Function SerializeDT(ByV al DTSource As DTProcess) As
MemoryStream
Dim ms As New MemoryStream
Dim formatter As New BinaryFormatter
formatter.Seria lize(ms, DTSource)
ms.Position = 0
Return ms
End Function

-John Oakes
"Gordz" <jo*****@aol.co m> wrote in message
news:10******** ****@corp.super news.com...
I've been experiencing problems on some computers with XML Serialization.
On
some computers the files do not get created on the web server's hard

drive and it's been driving me nuts trying to figure it out.

I store navigation history and application state in object collections and save this upon application exit by doing an XML.Serialize.

I'd like to serialize directly to SQL Server instead. Can I create a

stream
object to be used by SQL Server with serialization?

Thanks


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
24674
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream s); public void Deserialize(Stream s); Within the MyUserControl class, there is a field of type MyInnerClass
9
378
by: Hrvoje Voda | last post by:
I wrote this code to save a blob data into database. What is wrong? public ArrayList SetProfile(byte Profile) { ArrayList arrayProfile = new ArrayList ();
6
2692
by: Rod Snyder | last post by:
I'm trying to set up an asp.net (vb.net) that will allow a user to insert/update a bio/profile. I wanted to create a SQL Server 2000 table that includes their contact info and bio info. However, I'm not getting SQL Server to accept more than about two paragraphs of info. I've tried the datatypes of ntext and nvar char to no success. I'm...
7
6310
by: gemel | last post by:
I am developing an application that uses SQL 2000 as my source of images. I have successfully created the code to load the images onto the SQL Server and also to retrieve the images into a dataset. I tested the application by populating a Dataset with the images from SQL Server and rendered just one of the images by using a bitmap and...
2
3734
by: Chucker | last post by:
Hi Community, I think I can store Binary Data in SQL Server but when I try to retrieve it, I always only get one byte. I think I stored my Binary Data in SQL Server in a Colum of Type Image. At least when I execute the following code, I get some significant network traffic. When I check the database with query analyzer, I see 4 Hex Chars...
15
2561
by: Pucca | last post by:
I'm getting an error when I tried to use this BerConverter class in my C# code. Even though the Interent doc says that it runs on Win2000 sp4, I just thgouth I'll double check. Does anyone know if BerConverter is supported for Win2000 server? http://msdn2.microsoft.com/en-us/library/system.directoryservices.protocols.berconverter.decode.aspx...
3
5539
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, I am using dotnet remoting with a binarry formatter. I have a property that returns a memorystream that has had a file loaded into it. When I try to access this property though I get an error regarding "the proxy has no channel sink.......or no suitable Client channel to talk to the server."
46
2137
by: RAZZ | last post by:
Hello, Can anyone suggest me solution? I Need to manage different types of documents (doc,xls,ppt etc) in server. I have folder structure to maintain these documents in server. Say folder1 is having all doc files; folder2 is having all xls files and so on. Now these documents should not be able to get access through the url
4
4219
by: skunapareddy | last post by:
I am needing to read a blob from database and pass it to another java program. I researched internet and found a program that reads a file on the client pc and gives bytes, but when I modified the code to read a blob from DB I am not having any luck, I am running this java programs using JDEVELOPER. Can anyone please give me some help? The code...
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7808
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7423
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7757
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5329
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3443
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.