VB.net编程进行数据导入后出现乱码问题 10
用VB.NET实现将TXT文件导入到EXCEL中(实际不是EXCEL文件,而是CSV文件),导入后出现部分乱码,也就是EXCEL不能识别,想问一下,在VB程序中插入什么语...
用VB.NET实现将TXT文件导入到EXCEL中(实际不是EXCEL文件,而是CSV文件),导入后出现部分乱码,也就是EXCEL不能识别,想问一下,在VB程序中插入什么语句可以解决这个问题?
图示为TXT文件中不能被EXCEL识别的名称。其中NAME对应项导入到EXCEL后是乱码。 展开
图示为TXT文件中不能被EXCEL识别的名称。其中NAME对应项导入到EXCEL后是乱码。 展开
展开全部
'access 数据表表名:chexing
'结构id、chexing、chang、kuan、gao
Dim id() As Long
Dim chang() As Long
Dim kuan() As Long
Dim gao() As Long
Private Sub Combo1_Click()
Text1.Text = chang(Combo1.ListIndex)
Text2.Text = kuan(Combo1.ListIndex)
Text3.Text = gao(Combo1.ListIndex)
End Sub
Private Sub Form_Load()
ReDim id(0)
ReDim chang(0)
ReDim kuan(0)
ReDim gao(0)
Combo1.Clear
db = "d:\chexing.mdb"
connstr = "DBQ=" + db + ";DefaultDir=;DRIVER="
Set conn = CreateObject("ADODB.Connection")
conn.Open connstr
websql = "select * from chexing order by id"
Set rs = CreateObject("adodb.recordset")
rs.Open websql, conn, 1, 1
If rs.EOF And rs.BOF Then
Else
Do While Not rs.EOF
Combo1.AddItem rs("chexing")
id(UBound(id)) = rs("id")
ReDim Preserve id(UBound(id) + 1)
chang(UBound(chang)) = rs("chang")
ReDim Preserve chang(UBound(chang) + 1)
kuan(UBound(kuan)) = rs("kuan")
ReDim Preserve kuan(UBound(kuan) + 1)
gao(UBound(gao)) = rs("gao")
ReDim Preserve gao(UBound(gao) + 1)
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
Set conn = Nothing
Combo1.ListIndex = 0
End Sub
'结构id、chexing、chang、kuan、gao
Dim id() As Long
Dim chang() As Long
Dim kuan() As Long
Dim gao() As Long
Private Sub Combo1_Click()
Text1.Text = chang(Combo1.ListIndex)
Text2.Text = kuan(Combo1.ListIndex)
Text3.Text = gao(Combo1.ListIndex)
End Sub
Private Sub Form_Load()
ReDim id(0)
ReDim chang(0)
ReDim kuan(0)
ReDim gao(0)
Combo1.Clear
db = "d:\chexing.mdb"
connstr = "DBQ=" + db + ";DefaultDir=;DRIVER="
Set conn = CreateObject("ADODB.Connection")
conn.Open connstr
websql = "select * from chexing order by id"
Set rs = CreateObject("adodb.recordset")
rs.Open websql, conn, 1, 1
If rs.EOF And rs.BOF Then
Else
Do While Not rs.EOF
Combo1.AddItem rs("chexing")
id(UBound(id)) = rs("id")
ReDim Preserve id(UBound(id) + 1)
chang(UBound(chang)) = rs("chang")
ReDim Preserve chang(UBound(chang) + 1)
kuan(UBound(kuan)) = rs("kuan")
ReDim Preserve kuan(UBound(kuan) + 1)
gao(UBound(gao)) = rs("gao")
ReDim Preserve gao(UBound(gao) + 1)
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
Set conn = Nothing
Combo1.ListIndex = 0
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询