如何將 unicode 存入 MSSQL 資料庫中

有關Delphi 的語法, 程式, 等
回覆文章
頭像
tim
文章: 1380
註冊時間: 2008年 11月 26日, 00:49

如何將 unicode 存入 MSSQL 資料庫中

文章 tim »

請參考討論:
http://delphi.ktop.com.tw/topic.asp?TOPIC_ID=48121

使用方式:

代碼: 選擇全部

procedure Tform1.Button4Click(Sender: TObject);
var
 wstr: Array[0..2048] of WideChar;
 ws: Widestring;
begin
 GetPrivateProfileStringW('MY Section', 'A3', '', PWideChar(@wstr), 2048, 'c:1.ini');
 ws := wstr;
 ADOQuery1.SQL.Text := 'Insert Into test (F1, F2, F3) values (:v1, :v2, :v3)';
 ADOQuery1.Parameters.ParseSQL(ADOQuery1.SQL.Text, true);

 //... assign v1, v2 ..
 
 ADOQuery1.Parameters.ParamByName('v3').DataType := ftWideString;
 ADOQuery1.Parameters.ParamByName('v3').value := ws;
 
 ADOQuery1.ExecSQL;
end; 
多多留言, 整理文章, 把經驗累積下來.....
回覆文章