B?n m?t cch chnh xc khng th? d?ch d? li?u nhn v?t t? m?t khch hng ?n m?t my ch? b?ng cch s? d?ng tr?nh i?u khi?n SQL Server ODBC n?u khch hng m? trang khc v?i tran...

D?ch tiu ? D?ch tiu ?
ID c?a bi: 234748 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?

TRI?U CH?NG

Khi s? d?ng MDAC 2,1 ho?c phin b?n sau c?a tr?nh i?u khi?n SQL Server ODBC (Phin b?n 3.70.0623 ho?c sau ny) ho?c cc nh cung c?p OLEDB (Phin b?n 7.01.0623 ho?c sau ny), trong m?t s? tr?ng h?p no b?n c th? g?p d?ch d? li?u k? t? t? trang m? khch hng ?n trang m? my ch?, ngay c? khi Autotranslation b? v hi?u ho cho k?t n?i.

NGUYN NHN

Autotranslation khng ph?i l c ch? duy nh?t m c th? d?n ?n chuy?n ?i trang m?. SQL Server 7.0 ODBC li xe v nh cung c?p OLEDB gi?i thi?u m?t hnh vi m?i khi k?t n?i t?i MSDE 1.0, SQL Server 7.0 ho?c phin b?n m?i nh?t c?a m?t trong hai. T?t c? cc SQL pht bi?u ?c g?i nh l m?t s? ki?n ngn ng? ?c chuy?n ?i sang Unicode trn my khch tr?c khi ?c g?i ?n my ch?. C hi?u l?c cu?i cng ny l tng t? nh m?t Autotranslation t?t c? d? li?u ch?y t? cc khch hng ph?c v? thng qua m?t s? ki?n ngn ng?, b?t k? c?a hi?n t?i Autotranslation ci ?t cho k?t n?i. i?u ny s? khng gi?i thi?u b?t k? kh khn tr? khi c? g?ng ? lu tr? d? li?u k? t? khng d?ch t? m?t trang m? khc ngoi trang m? SQL Server.

CCH GI?I QUY?T KHC

Khng nn c?t m? trang x d? li?u trong m?t trang m? Y SQL Server (v d?, m? trang 950 data trong m?t m? trang 1252 server). Trong khi i?u ny l c th? c trong m?t s? tr?ng h?p v?i phin b?n tr?c c?a SQL Server, n lun lun l khng ?c h? tr?. ?n m?t my ch? SQL 1252, b?t c? i?u g? nhng m?t 1252 nhn v?t l khng d? li?u nhn v?t h?p l?. Non-Unicode k? t? d? li?u t? m?t trang khc nhau m? s? khng ?c s?p x?p m?t cch chnh xc, v trong tr?ng h?p c?a kp-byte d? li?u (DBCS), SQL Server s? khng cng nh?n ranh gi?i c?a nhn v?t m?t cch chnh xc. i?u ny c th? gy ra v?n ? quan tr?ng, ch?ng h?n nh v?n ? m t? trong bi vi?t sau trong c s? ki?n th?c Microsoft:
155723 INF: SQL Server truncation c?a m?t chu?i DBCS
S? l?a ch?n t?t nh?t cho SQL Server m? trang l trang m? c?a cc khch hng s? truy c?p vo my ch?.

Cc my ch? v khch hng c th? khc nhau m? trang, nhng b?n ph?i ?m b?o r?ng Autotranslation ?c b?t trn my khch, do b?n c ?c ng d?ch d? li?u ?n v i t? cc my ch? trang m? trong m?i tr?ng h?p.

N?u my ch? c?a b?n ph?i lu tr? d? li?u t? nhi?u m? trang, cc gi?i php ?c h? tr? l ? lu tr? d? li?u trong Unicode c?t (NCHAR/NVARCHAR/NTEXT).

N?u t?nh h?nh c?a b?n ?i h?i r?ng b?n lu tr? d? li?u trang x m? trong m?t trang m? Y SQL Server, c nh?ng ch? c hai cch ? lm i?u ny ng tin c?y:
  • Lu tr? d? li?u trong c?t c?t nh? phn (BINARY/VARBINARY/h?nh ?nh).
  • Vi?t ?ng d?ng c?a b?n ? s? d?ng cu?c g?i th? t?c t? xa (RPCs) cho t?t c? cc SQL pht bi?u m ?i ph v?i d? li?u k? t?. D? li?u ?c g?i thng qua m?t s? ki?n RPC l khng ph?i chuy?n ?i ny. Lu ? r?ng khng c g? lc cc tr?nh i?u khi?n ho?c DSN m?c m b?n c th? lm ? thay ?i lo?i s? ki?n ?c g?i i ?c. Cho d m?t l?nh ?c g?i nh m?t ngn ng? ho?c s? ki?n RPC ph? thu?c hon ton vo cc API v c php ?c l?a ch?n b?i cc l?p tr?nh vin khi ?ng d?ng ?c vi?t.

THNG TIN THM

Autotranslation (c ngh?a l, cc h?p ki?m "Th?c hi?n d?ch cho d? li?u nhn v?t" trong cc ?ng d?ng m?i hn ODBC) chuy?n ?i d? li?u k? t? t? trang m? khch hng ?n trang m? my ch? tr?c khi g?i d? li?u ?n my ch?, s? d?ng Unicode nh m?t phng ti?n d?ch. Tuy nhin, tr?nh i?u khi?n SQL Server ODBC 3,7 c?ng chuy?n ?i t?t c? SQL pht bi?u ?c g?i nh l m?t s? ki?n ngn ng? ?n Unicode tr?c khi ?t chng trn dy, c hi?u l?c m l tng t? nh Autotranslation nhng khng ?c i?u hnh b?i cc thi?t l?p Autotranslation. Ng?c l?i, d? li?u k? t? ch?y t? h? ph?c v? quay l?i khch hng tn tr?ng c? Autotranslation; N?u Autotranslation ? b? t?t d? li?u ?n lc khch hng ?ng d?ng v?i cc m? s? nhn v?t tng t? nh cc d? li?u ? c trn h? ph?c v?. Tng t?, b?n d?ch c?a cc d? li?u cho cc s? ki?n RPC khch hng/my ch? c th? ?c v hi?u ha b?ng cch t?t Autotranslation. M?t k?ch b?n n gi?n th? hi?n cch hnh vi ny ?nh h?ng ?n cc s? ki?n ngn ng? sau. V d? ny ch?y t? truy v?n Analyzer trn m?t m? trang 1252 khch hng k?t n?i v?i m?t my ch? 437 trang m?:
-- Turn Autotranslation off here.
    USE tempdb
    GO
    CREATE TABLE t1 (c1 int, c2 char(1))
    GO
    
    -- Enter a yen character, using the keystroke ALT-0165.
    INSERT INTO t1 VALUES (1, '') 
    SELECT c1, c2, ASCII (c2) FROM t1
c1          c2               
        ----------- ---- ----------- 
        1               157
        
        (1 row(s) affected)
Lu ? sau y v? v d? tr?c:
  • M?c d Autotranslation ? t?t trong ?t ny, m? k? t? 165 (yn trong m? trang 1252) ?c c?i bi?n thnh 157 (yn trong m? trang 437). i?u ny l b?i v? tr?nh i?u khi?n ODBC chuy?n thnh chu?i SQL Unicode tr?c khi g?i n cc h? ph?c v?, do , cc my ch? ? c th? chuy?n n sang k? t? thch h?p cho vi?c lu tr? trong m? trang 437.
  • Khi khch hng ch?y m?t CHON truy xu?t d? li?u ? c ch? ?c lu tr?, nhn v?t 157 ?n khng d?ch my khch (157 hi?n ln nh m?t h?p "" trn m?t khch hng trang 1252 m?). i?u ny l do vi?c chuy?n ?i th?o lu?n trong bi vi?t ny ch? p d?ng cho d? li?u ?c g?i t? cc khch hng ?n my ch?, khng ph?i t? h? ph?c v? cho khch hng. D? li?u khng ?c d?ch b?i v? thi?t l?p Autotranslation l t?t.

-- Turn Autotranslation back on before running the following batch.
    INSERT INTO t1 VALUES (2, '')
    SELECT c1, c2, ASCII (c2) FROM t1
c1          c2               
        ----------- ---- ----------- 
        1               157
        2               157
        
        (2 row(s) affected)
Trong tr?ng h?p ny, b?t Autotranslation l?i ? khng c hi?u l?c trn b?n d?ch t? cc khch hng ?n cc my ch? ? x?y (c ngh?a l, cc b?n d?ch chnh xc cng m?t t? m? k? t? 165 ? m? k? t? 157 ra), nhng n ? c hi?u l?c t? ngy cc d? li?u L?y t? h? ph?c v?. Lu ? r?ng khi cc CHON tuyn b? ?c i?u hnh th?i gian ny (v?i Autotranslation ngy), k? hi?u yn hi?n th? ng trong m? trang 1252 ?ng d?ng b?i v? h? c d?ch t? m? k? t? 157 quay l?i m? k? t? 165 c?a c ch? Autotranslation.

B?n s? th?y hnh vi ny (chuy?n cc s? ki?n ngn ng? sang Unicode trn my khch) khi s? d?ng b?t k? SQL Server ODBC tr?nh i?u khi?n phin b?n 3,70 ho?c sau v k?t n?i v?i SQL Server 7.0 ho?c cao hn. N s? khng x?y ra khi s? d?ng tr?nh i?u khi?n ODBC c? hn, ho?c khi s? d?ng tr?nh i?u khi?n 3,7 ? k?t n?i v?i SQL Server 6,5 ho?c tr?c . Ngoi ra, n?u b?n ang lu tr? d? li?u c?a b?n trong Unicode c?t (NCHAR/NVARCHAR/NTEXT) vi?c chuy?n ?i s? khng l m?t v?n ?.
? bi?t thm chi ti?t v? cch d? li?u k? t? ?c ?i di?n trong SQL Server 2005, nh?p vo s? bi vi?t sau ? xem bi vi?t trong c s? ki?n th?c Microsoft:
904803D? li?u k? t? ?c ?i di?n khng chnh xc khi trang m? my khch khc v?i trang m? c?a c s? d? li?u trong SQL Server 2005

Thu?c tnh

ID c?a bi: 234748 - L?n xem xt sau cng: 21 Thang Tam 2011 - Xem xt l?i: 2.0
p d?ng
  • Microsoft SQL Server 7.0 Standard Edition
  • Microsoft SQL Server 2000 Standard Edition
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Enterprise Edition
  • Microsoft SQL Server 2005 Express Edition
  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Workgroup Edition
T? kha:
kbprb kbmt KB234748 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:234748

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com