From: Eric on
Hi,

For my webapplication I have a structure with strings, booleans and datasets.
I use it to store the information that the user has entered.

The datasets contain data from a part where the user can add multiple rows
of data.

I want to move this data to a file so it can be read by a windows application.
The webform is basicly a request form.

I thought of serializing it because that is a nice way to transfer the data.
When I serialize the data to a file, all the data from the strings, dates
and booleans are in it, but from the datasets I only see the structure but
not the data.

What am I doing wrong?

here is my code:
Dim rq As New Request 'structure

rq.Customer = Me.cbCustomer.Text
rq.RequestDate = CDate(Me.txtRequestDate.Text)
rq.DeliveryDate = CDate(Me.btDeliveryDate.Text)
rq.NameRequestor = Me.txtNameRequestor.Text
rq.DepartmentRequestor = Me.txtDepartmentRequestor.Text
rq.MobileNrRequestor = Me.txtMobileNrRequestor.Text
rq.EmailRequestor = Me.txtEmailRequestor.Text
If Me.rbSameAsAboveNo.Checked = True Then rq.SameAsAbove = False Else
rq.SameAsAbove = True
rq.NameOwner = Me.txtNameOwner.Text
rq.DepartmentOwner = Me.txtDepartmentOwner.Text
rq.MobileNrOwner = Me.txtMobileNrOwner.Text
rq.EmailOwner = Me.txtEmailOwner.Text
rq.FlocNrOwner = Me.txtFlocNrOwner.Text
rq.EmailFlocOwner = Me.txtEmailFlocOwner.Text
rq.EquipLocRequest = Me.txtEquipLocRequest.Text
rq.ProjectNameRequest = Me.txtProjectNameRequest.Text
rq.LocationRequest = Me.cbLocationRequest.Text
If Me.rbNewHardwareNo.Checked = True Then rq.NewHardware = False Else
rq.NewHardware = True
If Me.rbFloorSpaceNo.Checked = True Then rq.FloorSpace = False Else
rq.FloorSpace = True
rq.CabPositionRequest = Me.txtCabPositionRequest.Text
rq.SystemNameRequest = Me.txtSystemNameRequest.Text
If rbPopLocationNo.Checked = True Then rq.PopLocation = False Else
rq.PopLocation = True
If rbDataCenterLocationNo.Checked = True Then rq.DataCenterLocation =
False Else rq.DataCenterLocation = True

'IP view
rq.dataIP = New Data.DataSet
rq.dataIP = dsIP

'Cabling view
rq.dataCabling = New Data.DataSet
rq.dataCabling = dsTR

'Power view
rq.dataPW = New Data.DataSet
rq.dataPW = dsPW

'Firewall view
rq.NameManagerFW = Me.txtNameManagerFW.Text
rq.EmailManagerFW = Me.txtEmailManagerFW.Text

rq.dataFW = New Data.DataSet
rq.dataFW = dsFW

Dim filename As String = Server.MapPath("~\temp\") & "IPconRequest_" &
rq.Customer & "_" & rq.NameRequestor & ".xml"

Dim fs As New FileStream(filename, FileMode.Create)
Dim bf As New BinaryFormatter

bf.Serialize(fs, rq)
fs.Flush()
fs.Close()


'below to check the data
rq = New Request
fs = New FileStream(filename, FileMode.Open)
rq = CType(bf.Deserialize(fs), Request)

fs.Close()

rg,
Eric

From: Eric on
nvm.

dataset was not properly filled :-(

problem solved.


"Eric" wrote:

> Hi,
>
> For my webapplication I have a structure with strings, booleans and datasets.
> I use it to store the information that the user has entered.
>
> The datasets contain data from a part where the user can add multiple rows
> of data.
>
> I want to move this data to a file so it can be read by a windows application.
> The webform is basicly a request form.
>
> I thought of serializing it because that is a nice way to transfer the data.
> When I serialize the data to a file, all the data from the strings, dates
> and booleans are in it, but from the datasets I only see the structure but
> not the data.
>
> What am I doing wrong?
>
> here is my code:
> Dim rq As New Request 'structure
>
> rq.Customer = Me.cbCustomer.Text
> rq.RequestDate = CDate(Me.txtRequestDate.Text)
> rq.DeliveryDate = CDate(Me.btDeliveryDate.Text)
> rq.NameRequestor = Me.txtNameRequestor.Text
> rq.DepartmentRequestor = Me.txtDepartmentRequestor.Text
> rq.MobileNrRequestor = Me.txtMobileNrRequestor.Text
> rq.EmailRequestor = Me.txtEmailRequestor.Text
> If Me.rbSameAsAboveNo.Checked = True Then rq.SameAsAbove = False Else
> rq.SameAsAbove = True
> rq.NameOwner = Me.txtNameOwner.Text
> rq.DepartmentOwner = Me.txtDepartmentOwner.Text
> rq.MobileNrOwner = Me.txtMobileNrOwner.Text
> rq.EmailOwner = Me.txtEmailOwner.Text
> rq.FlocNrOwner = Me.txtFlocNrOwner.Text
> rq.EmailFlocOwner = Me.txtEmailFlocOwner.Text
> rq.EquipLocRequest = Me.txtEquipLocRequest.Text
> rq.ProjectNameRequest = Me.txtProjectNameRequest.Text
> rq.LocationRequest = Me.cbLocationRequest.Text
> If Me.rbNewHardwareNo.Checked = True Then rq.NewHardware = False Else
> rq.NewHardware = True
> If Me.rbFloorSpaceNo.Checked = True Then rq.FloorSpace = False Else
> rq.FloorSpace = True
> rq.CabPositionRequest = Me.txtCabPositionRequest.Text
> rq.SystemNameRequest = Me.txtSystemNameRequest.Text
> If rbPopLocationNo.Checked = True Then rq.PopLocation = False Else
> rq.PopLocation = True
> If rbDataCenterLocationNo.Checked = True Then rq.DataCenterLocation =
> False Else rq.DataCenterLocation = True
>
> 'IP view
> rq.dataIP = New Data.DataSet
> rq.dataIP = dsIP
>
> 'Cabling view
> rq.dataCabling = New Data.DataSet
> rq.dataCabling = dsTR
>
> 'Power view
> rq.dataPW = New Data.DataSet
> rq.dataPW = dsPW
>
> 'Firewall view
> rq.NameManagerFW = Me.txtNameManagerFW.Text
> rq.EmailManagerFW = Me.txtEmailManagerFW.Text
>
> rq.dataFW = New Data.DataSet
> rq.dataFW = dsFW
>
> Dim filename As String = Server.MapPath("~\temp\") & "IPconRequest_" &
> rq.Customer & "_" & rq.NameRequestor & ".xml"
>
> Dim fs As New FileStream(filename, FileMode.Create)
> Dim bf As New BinaryFormatter
>
> bf.Serialize(fs, rq)
> fs.Flush()
> fs.Close()
>
>
> 'below to check the data
> rq = New Request
> fs = New FileStream(filename, FileMode.Open)
> rq = CType(bf.Deserialize(fs), Request)
>
> fs.Close()
>
> rg,
> Eric
>