MS Access查询返回中文字符 [英] MS Access query returning Chinese characters

查看:92
本文介绍了MS Access查询返回中文字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新手,我试图修复别人的访问数据库,当我运行其中一个查询时,查询会在所有文本字段中返回中文字符(它们被设置为长文本)和查询正在执行分组。我该如何解决?以下是查询的SQL:

I?m new to access and I?m trying to fix someone else''s access database and when I run one of the queries the query returns Chinese characters in all the text fields (they are set as long text) and the query is doing a group by. How do I fix this? Here is the SQL for the query:

展开 | 选择 | Wrap | 行号

推荐答案

mjp58:

在备注字段(又名文字长)上分组时有一个旧的错误

字节线程:访问:意外获得中文(?)字符,为什么?


制作一个您的查询副本

在副本中,为每个长文本字段创建一个计算字段。 />
示例如果[dbo_Requisitions.buyer]是数据类型Text-Long

然后创建一个计算字段为

zShrtBuyer:Left([dbo_Requisitions.buyer], 255)


(您也可以根据数据需要使用MID()函数)


为所有您的长文本字段...
mjp58:
There was an old bug when grouping on Memo fields (aka Text Long)
(Bytes Thread: Access: getting chinese (?) character unexpectedly, why? )

Make a copy of your query
In the copy, create a calculated field for each of the long-text fields.
Example if [dbo_Requisitions.buyer] is datatype Text-Long
Then create a calculated field as
zShrtBuyer: Left([dbo_Requisitions.buyer],255)

(you can also use a MID() function depending on what you need from the data)

Do this for all of your long-text fields such that...
展开 | 选择 | Wrap | 行号


假设zmbd是正确的,他通常是,我在猜除了备注之外,大多数文本字段应该是短文本(255 c haracters)或日期。


查看表格中的数据,看看是否有超过255个字符长的字段,以及数据是否与字段类型匹配。


如果你改变了表结构,请确保所有内容都已备份。


Phil
Assuming zmbd is correct, and he usually is, I am guessing that with the possible exception of remarks, most of the text fields should be short text (255 characters) or dates.

Have a look at your data in the table and see if there are any fields that are over 255 characters long, and whether the data matches the field type.

If you do alter the table structure, make sure everything is backed up.

Phil


除非我正在写一本书,否则我会尽量避免使用备忘录字段。如果我有长评论(或通常,多条评论添加到一条记录),我将创建一个评论表,使用主表的PK按记录分组评论。
Unless I am writing a book, I try to avoid memo fields. If I have long comments (or typically, multiple comments added to one record), I will create a table of comments, using the main table''s PK to group comments by record.


这篇关于MS Access查询返回中文字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆