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] 이미지(png, jpg, bmp 등) 파일을 아이콘(ico) 파일로 변환 20.09.14
- 다음글[vb.net] HtmlAgilityPack 라이브러리를 이용한 크롤링시 라이브러리 사용 예시 20.09.08
댓글목록
등록된 댓글이 없습니다.