Controls [vb.net] DataTable 내용을 XML로 저장 및 불러오기
페이지 정보
본문
Example 1:)
Write:
dt1.TableName = "MyDataTable"
dt1.WriteXmlSchema(Application.StartupPath + "\test_sh.xml", True)
dt1.WriteXml(Application.StartupPath + "\test_dt.xml", True)
Read:
dt2 = New DataTable
dt2.ReadXmlSchema(Application.StartupPath + "\test_sh.xml")
dt2.ReadXml(Application.StartupPath + "\test_dt.xml")
Example 2:)
Write:
Dim writer As System.IO.StringWriter = New System.IO.StringWriter()
customerTable.WriteXml(writer, XmlWriteMode.WriteSchema, False)
Write:
writer = New System.IO.StringWriter()
customerTable.WriteXml(writer, XmlWriteMode.WriteSchema, True)
Example 3:)
Write:
Dim xmlStream As System.IO.MemoryStream = New System.IO.MemoryStream()
table.WriteXml(xmlStream, XmlWriteMode.WriteSchema)
xmlStream.Position = 0
Read:
Dim newTable As DataTable = New DataTable()
newTable.ReadXml(xmlStream)
Example 4:)
Write:
Dim fileName As String = "C:\TestData.xml"
table.WriteXml(fileName, XmlWriteMode.WriteSchema)
Read:
Dim newTable As DataTable = New DataTable()
newTable.ReadXml(fileName)
- 이전글[vb.net] DateTimePicker 표시형식 변경 20.09.15
- 다음글[vb.net] 글꼴 크기를 포함하여 양식의 크기가 조정될 때 모든 컨트롤의 동적 크기 조정 및 위치 조정 20.08.21
댓글목록
등록된 댓글이 없습니다.