UNICODE文字新增到 SQL SERVER 問題 |
答題得分者是:Stallion
|
foxelf
初階會員 發表:9 回覆:42 積分:30 註冊:2003-03-05 發送簡訊給我 |
|
Stallion
版主 發表:52 回覆:1600 積分:1995 註冊:2004-09-15 發送簡訊給我 |
|
foxelf
初階會員 發表:9 回覆:42 積分:30 註冊:2003-03-05 發送簡訊給我 |
Stallion大大你好
我的欄位是 nText 型態,欄位要存的資料會很多 我也試過指定 DATATYPE := ftWideString 但是會自動變成 ftFixedChar 所以我只有在用組SQL方式有成功過,用ParamByName('DataMemo').Value := TntMemo1.Text ;存到資料庫UNICODE字元都會變成"?" ===================引 用 Stallion 文 章=================== Field Type = nvarchar |
Stallion
版主 發表:52 回覆:1600 積分:1995 註冊:2004-09-15 發送簡訊給我 |
As I know TADOQuery doesn't support unicode manipulation, use TNTUnicodecontrol and it's extention TNTEx (there's TTntADOQuery inside).
Please check out below link and then you can find those files, and download TntUnicodeControl 2.1.11 then you will have no problem to comply with TntEX. http://www.yunqa.de/delphi/doku.php/products/tntunicodecontrols/index ( this link is for TNTUnicodeControl) http://web.archive.org/web/*sr_11nr_10/http://download.tntware.com/* ( this link is for TNTEx) By the way, you need to read and write unicode value trough TTntADOQuery as below example . aQuery.ParamValue['DataMemo'] := TntMemo1.Text; or TntMemo1.Text := aQuery.ParamValue['DataMemo'];
編輯記錄
Stallion 重新編輯於 2009-08-03 13:27:21, 註解 無‧
|
foxelf
初階會員 發表:9 回覆:42 積分:30 註冊:2003-03-05 發送簡訊給我 |
Stallion你好
TNTADOQuery 我試過也是不行,ParamValue好像沒這個屬性,但我用過aQuery.FieldValues['XXX'] := TntMemo1.Text 結果還是一樣的 ===================引 用 Stallion 文 章=================== As I know TADOQuery doesn't support unicode manipulation, use TNTUnicodecontrol and it's extention TNTEx (there's TTntADOQuery inside). Please check out below link and then you can find those files, and download TntUnicodeControl 2.1.11 then you will have no problem to comply with TntEX. http://www.yunqa.de/delphi/doku.php/products/tntunicodecontrols/index ( this link is for TNTUnicodeControl) http://web.archive.org/web/*sr_11nr_10/http://download.tntware.com/* ( this link is for TNTEx) By the way, you need to read and write unicode value trough TTntADOQuery as below example . aQuery.ParamValue['DataMemo'] := TntMemo1.Text; or TntMemo1.Text := aQuery.ParamValue['DataMemo']; |
Stallion
版主 發表:52 回覆:1600 積分:1995 註冊:2004-09-15 發送簡訊給我 |
yes, my fault, it should be
aQuery.FieldValue['XXX'] := TntMemo1.Text; and I also checked MSSQL online book that ntext does support unicode char, and I did successfully access MSSQL Server ntext, nvarchar fields with unicode string before by the method shown above. That's all I can tell you, you need to find where your codes go wrong, or you may post the snippet of codes here, other experts here could find out the problem for you. ===================引 用 foxelf 文 章=================== Stallion你好 TNTADOQuery 我試過也是不行,ParamValue好像沒這個屬性,但我用過aQuery.FieldValues['XXX'] := TntMemo1.Text 結果還是一樣的 ===================引 用 Stallion 文 章=================== As I know TADOQuery doesn't support unicode manipulation, use TNTUnicodecontrol and it's extention TNTEx (there's TTntADOQuery inside). Please check out below link and then you can find those files, and download TntUnicodeControl 2.1.11 then you will have no problem to comply with TntEX. http://www.yunqa.de/delphi/doku.php/products/tntunicodecontrols/index ( this link is for TNTUnicodeControl) http://web.archive.org/web/*sr_11nr_10/http://download.tntware.com/* ( this link is for TNTEx) By the way, you need to read and write unicode value trough TTntADOQuery as below example . aQuery.ParamValue['DataMemo'] := TntMemo1.Text; or TntMemo1.Text := aQuery.ParamValue['DataMemo']; |
foxelf
初階會員 發表:9 回覆:42 積分:30 註冊:2003-03-05 發送簡訊給我 |
Stallion你好
我寫的CODE如下,我 INSERT 的資料UNICODE的部分還是會變成"?" 我有找到其他方法解決,但並不是最好的解決方式 aQuery.Append ; aQuery.FieldValues['No'] := No ; aQuery.FieldValues['Court'] := bQuery.FieldByName('Court').AsInteger ; aQuery.FieldValues['year'] := bQuery.FieldByName('year').AsString ; aQuery.FieldValues['date'] := bQuery.FieldByName('Jdate').AsString ; // fullText = nText Type Field aQuery.FieldValues['fullText'] := bQuery.FieldByName('fullText').AsVariant ; aQuery.FieldValues['Analysis'] := bQuery.FieldByName('Analysis').AsString ; aQuery.FieldValues['Debate'] := bQuery.FieldByName('Debate').AsVariant ; aQuery.FieldValues['FactExc'] := bQuery.FieldByName('FactExc').AsVariant ; aQuery.FieldValues['key'] := Id ; aQuery.Post ; ===================引 用 Stallion 文 章=================== yes, my fault, it should be aQuery.FieldValue['XXX'] := TntMemo1.Text; and I also checked MSSQL online book that ntext does support unicode char, and I did successfully access MSSQL Server ntext, nvarchar fields with unicode string before by the method shown above. That's all I can tell you, you need to find where your codes go wrong, or you may post the snippet of codes here, other experts here could find out the problem for you. ============================================ 以下恕刪 |
Stallion
版主 發表:52 回覆:1600 積分:1995 註冊:2004-09-15 發送簡訊給我 |
please make sure bQuery is also a TTntADOQury class.
aQuery.Append ; aQuery.FieldValues['No'] := No ; aQuery.FieldValues['Court'] := bQuery.FieldByName('Court').AsInteger ; // if this field type is digit, then it doesn't have to be revised as below. aQuery.FieldValues['year'] := bQuery.FieldByName('year').AsString ; // same as above aQuery.FieldValues['date'] := bQuery.FieldByName('Jdate').AsString ; // same as above // fullText = nText Type Field aQuery.FieldValues['fullText'] := bQuery.FieldValues['fullText']; aQuery.FieldValues['Analysis'] := bQuery.FieldValues['Analysis']; aQuery.FieldValues['Debate'] := bQuery.FieldValues['Debate']; aQuery.FieldValues['FactExc'] := bQuery.FieldValues['FactExc']; aQuery.FieldValues['key'] := Id ; aQuery.Post ; |
foxelf
初階會員 發表:9 回覆:42 積分:30 註冊:2003-03-05 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |