高手們:
我有段程序:
==================
begin
close;
SQL.Clear;
SQL.Add('insert into xginfomation values');
SQL.Add('('''+bname+''','''+bcard+''','''+bsex+''','''+bportment+''','''+bphe+''','''+bpostid+''','''+xaddress+''','''+bpwd+''','''+bcardid+''')');
ADOQuery1.ExecSQL;
showmessage('recordcount====='+inttostr(recordcount));//這句有錯
if recordcount=1 then //這句同樣也有錯
showmessage('用戶信息輸入成功!')
else
showmessage('用戶信息增加出錯!');
//ADOinfomationtable.Close;
ADOinfomationtable.Open;
end;
==================我是想如果我插入了一條記錄,就提示用戶信息輸入成功,沒有就提示錯誤。可是有這個recordcount好像不可以啊?
大家幫我看看有什麽辦法。
謝謝。
仙女散分。
我有段程序:
==================
begin
close;
SQL.Clear;
SQL.Add('insert into xginfomation values');
SQL.Add('('''+bname+''','''+bcard+''','''+bsex+''','''+bportment+''','''+bphe+''','''+bpostid+''','''+xaddress+''','''+bpwd+''','''+bcardid+''')');
ADOQuery1.ExecSQL;
showmessage('recordcount====='+inttostr(recordcount));//這句有錯
if recordcount=1 then //這句同樣也有錯
showmessage('用戶信息輸入成功!')
else
showmessage('用戶信息增加出錯!');
//ADOinfomationtable.Close;
ADOinfomationtable.Open;
end;
==================我是想如果我插入了一條記錄,就提示用戶信息輸入成功,沒有就提示錯誤。可是有這個recordcount好像不可以啊?
大家幫我看看有什麽辦法。
謝謝。
仙女散分。
select 裡面是這樣來判斷是否有記錄的。
我用在insert有報錯。
close;
SQL.Clear;
SQL.Add('insert into xginfomation values');
SQL.Add('('''+bname+''','''+bcard+''','''+bsex+''','''+bportment+''','''+bphe+''','''+bpostid+''','''+xaddress+''','''+bpwd+''','''+bcardid+''')');
try
ADOQuery1.ExecSQL;
showmessage('用戶信息輸入成功!')
Except
showmessage('用戶信息增加出錯!');
End
end;
怎么会返回recordcount呢? 你需要再用select语句选择一下
ADOQuery1.ExecSQL;
showmessage('用戶信息輸入成功!')
Except
showmessage('用戶信息增加出錯!'); 楼主要好好了解下 recordcount的用法