Link to home
Start Free TrialLog in
Avatar of JMO9966
JMO9966

asked on

VB.Net - WriteXMLSchema fails on my DataTabe ? Cannot serialize the DataTable. DataTable name is not set.

I've used this same code for generating a schema file to use for Crystal Reporting but I've always used DataSet\DataTable.

In this case I simply have a DataTable.

  Private tblJB_Audit As New DataTable()

        Dim cols As DataColumnCollection = tblJB_Audit.Columns

        If cols.Contains("Week") = False Then
            Dim dcWeek As New DataColumn
            dcWeek.DataType = System.Type.GetType("System.String")
            dcWeek.AllowDBNull = True
            dcWeek.ColumnName = "Week"
            tblJB_Audit.Columns.Add(dcWeek)
        End If

 Dim workRow As DataRow = tblJB_Audit.NewRow()
                    'Dim strError As String
                    'strError = "Inventory shortage."

                    workRow("week") = strDate
                    workRow("OnHandQty") = OnHandQty
                    workRow("Supply_Qty") = SupplyQty
                    workRow("Part") = PartNo
                    workRow("Demand_Qty") = Qty
                    workRow("PAB") = AvailableQty

                    tblJB_Audit.Rows.Add(workRow)


 tblJB_Audit.WriteXmlSchema(Application.ExecutablePath & "Neill MRP View.xsd")

ERROR = Cannot serialize the DataTable. DataTable name is not set.

Not sure how to fix this error.  Can you give me a hand?

Thanks,
JMO9966
ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JMO9966
JMO9966

ASKER

Thanks Wayne,

I usually use DataSets and Fill with sql statements instead of creating DataTables.

I appreciate your quick response.

JMO9966