Using XSD ?

@simon

New member
Joined
Aug 14, 2008
Messages
1
Programming Experience
1-3
Im writing an app where I want to store a local dataset temporarily before inserting into a database. The scenario is a sales environment where until the sale is confirmed I dont want the records inserted into the db.

My way of thinking was to create a predefined XSD within the project, and then map this to a dataset variable in my class until I eventually need to insert the data into the DB.

I have done this before on an ASP.net application and so I thought I would use the same method. In the ASP.net application (and in the app's case when the class is initialised) I map an XSD to a Dataset variable like so:

Public Sub LoadDataFromXSD(ByVal xsdName As String, ByVal txtDatasetName As String, ByVal txtTableName As String, ByRef TargetDataset As DataSet, ByRef targetDataTable As DataTable)
Dim dsTemplate As Data.DataSet = New Data.DataSet(txtDatasetName)
Dim xrdr As New System.Xml.XmlTextReader(xsdName)
dsTemplate.ReadXmlSchema(xrdr)
xrdr.Close()
TargetDataset = dsTemplate
targetDataTable = dsTemplate.Tables(txtTableName)
End Sub


The problem here is that when building or publishing the application, the XSD file is not included in the build and so the app falls over as in cannot find the xsd file.

I have tried changing the properties of the XSD file ("Build Action" and "Copy to Output Directory") but this isnt working.

Can anyone suggest anything here - either a resolution to this or a better way of handling the temporay records.

Or do you think inserting straight into the DB would be ok (and then deleting if the sale does not proceed?).

Note this is using .net framework 2.0

Thanks

Simon
 
i'm slightly confused.. typically in client side apps we use the dataset designer (which can load your XSD and make a custom dataset out of it) to create a typed data access layer including all the db access necessities. See the DW2 link in my signature, section on Creating a SImple Data App
 
Back
Top