|
楼主 |
发表于 2023-11-28 09:13
|
显示全部楼层
网上查了有同样情况,解决方法添加CursorLocation值设置为adUseClient,重新刷新就显示正常字符了。
sql_str = "select content2.auto_bid,content2.zzh,content1.tjh,content1.zjxh,content1.mkxh,content1.mc,content1.des,content2.zs,content2.beizhu from content1,content2 where content2.tjh=content1.auto_bid and content2.zzh='" & zzh & "'"
Set rst = New ADODB.Recordset
With rst
.CursorLocation = adUseClient '----------------添加这一句
.Open sql_str, conn, 1, 1, adCmdText
If Not .BOF And Not .EOF Then
[a4].CopyFromRecordset rst '----------------用这句也能输出,只是其中有一个字段(名称都是文字),只输出2个字
'temp = .GetRows() '---------------------------用这句输出就正常,多个字
'Range("a4:i" & UBound(temp, 2) + 4) = Application.Transpose(temp)
MsgBox " O K !~", , "提示"
Else
MsgBox "没有查到对应数据!", , "提示"
End If
End With
conn.Close
Set rst = Nothing
Set conn = Nothing
|
|