Click here to Skip to main content
15,895,777 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
data in datagrid should be saved in separate file.
the file must show daily data where user entered in data grid
with this code the data in xml file is overwriting the old one and showing only new file.
please help me.
VB
Public Sub SwipeDTBind(ByVal EmplId As String)
        Try
            Dim ds As DataSet
            ds = New DataSet
            ds.Clear()
            ds.ReadXml("EmployeeTimeCard_1.XML")

            Dim dtbl As DataTable = ds.Tables(0)

            ds.Tables(0).DefaultView.Sort = "EmployeeId DESC"

            Dim dv As DataView = New DataView(dtbl)
            dv.RowFilter = "EmployeeId = '" & EmplId & "'"
            dv.Sort = "LoginTime"
            dtbl.Columns(0).ColumnMapping = MappingType.Hidden

            dtbl.Columns(1).ColumnMapping = MappingType.Hidden
            ds.WriteXml("E:\Syscom\EmployeeTimeCard\EmployeeTimeCard_1.XML", XmlWriteMode.IgnoreSchema)
            dgSwipedt.DataSource = dv

        Catch ex As Exception
            Me.ErrorLog(ex.Message.ToString())
        End Try
    End Sub
Posted
Updated 23-May-11 5:48am
v4

1 solution

If you want that is separate file then specify separate file name.

ds.WriteXml("E:\Syscom\EmployeeTimeCard\EmployeeTimeCard_" & Now.ToString("ddMMyyyyHHmmss") & ".XML", XmlWriteMode.IgnoreSchema)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900