Dim Raw As new List(of String)
For Each nd As WinForm.TreeNode In tv.AllNodes
If nd.Checked = True Then
Raw.Add(nd.Text)
End If
Next
If Raw.Count = 0 Then
messagebox.show("数据表至少选择一个.")
Return
End If
Dim dt As DataTable
Dim d As Date = Date.Now
Dim Name As String = d.Year & Format(d.Month,"00") & Format(d.Day,"00") & Format(d.Hour,"00") & Format(d.Minute,"00") & Format(d.Second,"00")
Dim Ex_Path As String = tb_path & "\表结构输出_" & name
For Each RawData As String In Raw
Select Case RawData
Case "测量信息"
dt = DataTables("1")
Case "原始数据"
dt = DataTables("2")
End Select
Select Case cb_Format
Case "TXT"
Ex_Path = Ex_Path & ".txt"
Dim bzf As String = RawData & vbcr & "列名" & vbtab & "类型" & vbtab & "长度"
FileSys.WriteAllText(Ex_Path ,vbcr & bzf,True,Encoding.Unicode) '''写入列名
For Each dc As DataCol In dt.DataCols
Dim s As String
s = dc.Name & vbtab & dc.datatype.Name & vbtab & dc.MaxLength
FileSys.WriteAllText(Ex_Path ,vbcr & s,True,Encoding.Unicode)
Next
Case "Excel"
...
end select
next
老师,我上面的代码想输出多个数表结构到文本文件或Excel文件中。以上是部分代码,选择了多个数据表,写入到文本文件时,只能写进去一个数据表的结构数据,是哪个地方出错了,Excel可以实现多个数据表结构输出