3-Tier新增資料時出現的錯誤~~麻煩各位大大解答 |
答題得分者是:shunaarom
|
duop2
一般會員 發表:5 回覆:1 積分:1 註冊:2004-08-22 發送簡訊給我 |
我在client寫了一個陣例Weight[1..9],內容存的都是Boolean,
下面是我client呼叫server的程式碼:
SocketConnection1.Connected := True;
SocketConnection1.AppServer.new_weight(Weight[1], Weight[2], Weight[3], Weight[4], Weight[5], Weight[6], Weight[7], Weight[8], Weight[9]);
SocketConnection1.Connected := False; 再來是我的server所對應的new_weight();
procedure Tweight.new_weight(owner_read, owner_write, owner_execute, group_read, group_write, group_execute, other_read, other_write, other_execute: WordBool);
var
ttSQL : String;
begin
ttSQL := 'Insert into Files(WeightOwnerWrite,WeightOwnerRead,WeightOwnerExecute,WeightGroupWrite,WeightGroupRead,WeightGroupExecute,WeightOtherWrite,WeightOtherRead,WeightOtherExecute) values (' + BoolToStr(owner_read) + ',' + BoolToStr(owner_write) + ',' + BoolToStr(owner_execute) + ',' + BoolToStr(group_read) + ',' + BoolToStr(group_write) + ',' + BoolToStr(group_execute) + ',' + BoolToStr(other_read) + ',' + BoolToStr(other_write) + ',' + BoolToStr(other_execute) + ') ' ;
ADODataSet1.Close;
ADODataSet1.CommandText := ttSQL;
ADODataSet1.Open;
ADODataSet1.Close;
end; 但我在Client Run到
SocketConnection1.AppServer.new_weight(Weight[1], Weight[2], Weight[3], Weight[4], Weight[5], Weight[6], Weight[7], Weight[8], Weight[9]);
的時候卻出現了以下的錯誤訊息! 請各位高手幫忙教導一下!謝謝!
|
jieshu
版主 發表:42 回覆:894 積分:745 註冊:2002-04-15 發送簡訊給我 |
引言: ttSQL := 'Insert into Files ADODataSet1.Close; ADODataSet1.CommandText := ttSQL; ADODataSet1.Open; 但我在Client Run到 SocketConnection1.AppServer.new_weight(Weight[1], Weight[2], Weight[3], Weight[4], Weight[5], Weight[6], Weight[7], Weight[8], Weight[9]); 的時候卻出現了以下的錯誤訊息!老兄, Insert, Update, Delete...等等的SQL要用Execute, 不能用Open的, 要用其他可Execute的ADO元件. 錯誤訊息是指您的ODBC設定有問題, 您要將ConnectionString和ODBC設定貼上來, 才有辦法幫您. <iFrame src="http://www.coss.com.tw/jieshu/sign.htm" width=400 height=105 scolling="NO" border="0"></iFrame> 震江系統(股)公司: http://www.coss.com.tw/ 捷舒軟體設計坊: http://www.coss.com.tw/jieshu/
------
人生有夢,逐夢而行 人若為善,福雖未至,禍已遠離 人若為惡,禍雖未至,福已遠離 http://www.taconet.com.tw/jieshu/ |
shunaarom
一般會員 發表:8 回覆:34 積分:18 註冊:2003-07-02 發送簡訊給我 |
不知這位大大有沒有用到ADOcommand~
如果有的話可以用這樣寫比較方便~
ttSQLStr:='INSERT INTO Voter (VoteC,UserID,VotePW) Values (''' a ''',''' b ''',''' c ''')';
ADOCommand1.CommandText:=ttSQLStr;
ADOcommand1.Execute;
這樣就可以新錯了~
但是ADODataSet的話~
ttSQLStr :='INSERT INTO Vote_Record (VoteC,UserID,ShortC) Values (''' icount ''',''' iarr ''',''' iret ''')';
ADODataSet1.Close;
ADODataSet1.CommandText := ttSQLStr;
ttCount := 0;
ADODataSet1.Open;
ADODataSet1.First;
if ADODataSet1.Eof then opcount:=1 else opcount:=0 ;
ttCount := ADODataSet1.RecordCount;
if ttCount>0 then begin
iarr := VarArrayCreate([0,2,0,ttCount-1], VarVariant);
ttCount := 0;
while not ADODataSet1.Eof do
begin
iarr[0, ttCount] := ADODataSet1.FieldByName('VoteC').AsString;
iarr[1, ttCount] := ADODataSet1.FieldByName('UserID').AsString;
iarr[2, ttCount] := ADODataSet1.FieldByName('ShortC').AsString;
inc(ttCount);
ADODataSet1.Next;
end;
end;
icount := ttCount;
這樣我是可以用啦~如果不行的話...那是不是你在如樓上大大說的問題了呢
|
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |