所有的操作最好都用SQL来实现,你要面的的问题很多。
解决方案 »
- coreide140.bpl是干嘛用的?老是引发内存访问错误!delphi2010的巨bug?
- 如何将现在网上的flash视频集成在应用程序中?
- 谁用个这个控件:Tline.dpk?
- 用Delphi调用.net写的webServrice出现的问题,急!!!!!
- 哪儿能下载《DELPHI4.0编程技术内幕》的配套光盘??
- CloneCD的序列号
- 打印问题,怎样把ListView当中的内容打印出来!
- 倾家荡产求购优秀系统分析案例
- 关于<Chart>控件如何在ISAPI或CGI下使用
- 谁有WINDOWS API FOR DELPHI的中文手册要有例程!!!!!!!
- 需要两个字段值才能定位,是不是连用两个locate就行了?
- 谢谢一休不休帮忙,送分200,请笑纳。(请斑竹不要删我的贴子,他确实帮了我大忙,谢谢!)
databasename:=’c:’;
tablename:=’renshi.dbf’;
indexfieldnames:=’bianhao’;
这段代码应该在table.close后再执行。
//如果stockinfos表里没有此'证券代码'、'申报代码'才会插入新记录
with daqSCodeStockInfos do
begin
if Active then Close;
SQL.Clear;
SQL.Add(' select vc_stock_code from runbase..stockinfos');
SQL.Add(' where vc_stock_code = ''' + sStockCode + '''');
Open;
First;
if Eof then
begin
with daqStockInfos do
try
ParamByName('c_exchange').AsString := sExchange;
ParamByName('vc_stock_code').AsString := sStockCode;
ParamByName('vc_stock_name').AsString := sStockName;
ParamByName('vc_report_code').AsString := sReportCode; ExecSQL;
except
on E: Exception do MessageDlg( E.Message, mtWarning, [ mbOK ], 0 );
end;
end;//end..if not Locate('vc_stock_code')
if Active then Close;
end;//end..with daqSCodeStockInfos do
var Action: TDataAction);
begin
//检测E就行了
end;
var Action: TDataAction);
begin
//检测E就行了
end;
begin
if Ammid_exist(trim(dbedit7.Text)) then
begin
showmessage('已有此编号!请重新输入!');
dbedit7.SetFocus;
exit;
end;
function tfyh.Ammid_exist(const Ammid:string):boolean;
var
amm:string;
begin
result:=false;
amm:=trim(ammid);
with dm.Qyh do
begin
close;
sql.Clear;
sql.Add('select Yh_ID from yh where trim(Amm_ID)='''+amm+'''');
open;
if recordcount>0 then
begin
result:=true;
exit;
end;
//-------------------------------------------查A表------------------------
close;
sql.Clear;
sql.Add('select Yh_ID from yh where trim(AmmB_ID)='''+amm+'''');
open;
if recordcount>0 then
begin
result:=true;
exit;
end;
//----------------------------------------查B表----------------------------
close;
sql.Clear;
sql.Add('select Yh_ID from yh where trim(AmmC_ID)='''+amm+'''');
open;
if recordcount>0 then
begin
result:=true;
exit;
end;
//----------------------------------------查C表---------------------------- end;//with dm.qyh do