LCHLynn 发表于 2012-7-23 14:29:22

qtp查询数据库后,显示乱码

为什么我查询数据后,显示的getvalue是乱码?高手请指教……多谢!

Dim conn
Set conn=CreateObject("ADODB.Connection")
conn.ConnectionString="Provider=MSDAORA.1;Password=abyy;User ID=abyy;Data Source=172.31.128.215/gzab;Persist Security Info=True;Charset=UTF-8"
conn.Open
If conn.State=0 Then
        Reporter.ReportEvent micFail,"Fail to connect oracle","conn.state="&conn.State
        ExitAction()
else
        Reporter.ReportEvent micPass,"Success to connect oracle","conn.state="&conn.State
End If

If conn.State<>0 Then
Dim rs
Set rs=CreateObject("ADODB.RecordSet")
Dim sql
sql="select name from zg_be"
rs.Open sql,conn,adOpenDynamic
rs.MoveFirst
Do while not rs.EOF
        getValue=rs("name")
        msgbox getvalue
        rs.MoveNext
Loop

AntonioNikki 发表于 2012-7-26 16:46:05

尝试更改编码类型:Charset=UTF-8
页: [1]
查看完整版本: qtp查询数据库后,显示乱码