这条SQL有问题吗?为什么添加不进去??在线等待 (30分)

3

3368aa

Unregistered / Unconfirmed
GUEST, unregistred user!
可感觉到执行这条SQL了,但就是找不到数据??

大家帮忙呀!!

procedure getdwID(bm,dw:string;geter:string);
var
quy:TADOQuery;
begin
quy:=mainform.selquy;
if quy.Active then quy.Close;
mainform.selquy.SQL.Clear;
quy.SQL.Add('select dw_id from dw where (bm=:bm and dw=:dw)');
quy.Parameters.ParamByName('bm').Value:=bm;
quy.Parameters.ParamByName('dw').Value:=dw;
mainform.selquy.open;
if quy.RecordCount>0 then
geter:=quy.Fields.Fields[0].AsString
else
geter:='';
end;


procedure zzadd;
var
addsql:widestring;
dw:string;
begin
viewunit.getdwID (trim(viewform.zz_bm.Text),trim(viewform.zz_dw.Text),dw);
addsql:='insert zz(name,sex,mz,born,jobdate,dw,IDCard,zhh,jnpay,gwpay,eachbt,gsbt,gzbt,ylbt,ylj,gjj,syj)'
+' values ('
+''''+ viewform.zz_name.text+''''
+','''+ viewform.zz_sex.text+''''
+','''+ viewform.zz_mz.text+''''
+','''+ datetimetostr(viewform.zz_born.date)+''''
+','''+ datetimetostr(viewform.zz_jobdate.date)+''''
+','''+ dw+''''
+','''+ viewform.zz_idcard.text+''''
+','''+ viewform.zz_zhh.text+''''
+','+ floattostr(viewform.zz_jnpay.Value)
+','+ floattostr(viewform.zz_gwpay.Value)
+','+ floattostr(viewform.zz_eachbt.Value)
+','+ floattostr(viewform.zz_gsbt.Value)
+','+ floattostr(viewform.zz_gzbt.Value)
+','+ floattostr(viewform.zz_ylbt.Value)
+','+ floattostr(viewform.zz_ylj.Value)
+','+ floattostr(viewform.zz_gjj.Value)
+','+ floattostr(viewform.zz_syj.Value)
+')';
with viewform.ADOCommand1 do
begin
// Cancel;
CommandType:=cmdtext;
CommandText:=addsql;
Execute;
end; // with
mainform.zzquy.Refresh;

end;

所有数据都正确,但就是在数据库中看不到这行数据????
 
insert into...
 
viewunit.getdwID (trim(viewform.zz_bm.Text),trim(viewform.zz_dw.Text),dw);
addsql:='insert zz(name,sex,mz,born,jobdate,dw,IDCard,zhh,jnpay,gwpay,eachbt,gsbt,gzbt,ylbt,ylj,gjj,syj)'

这里应该是 addsql := 'insert into ....'
不明白?
 
为什么我在 查询分析器却能实现?
 
procedure getdwID(bm,dw:string;var geter:string);
///
最后一个应该是变参吧!!!!!
 
解析方式不一样啦
 
后台用的是SQL SERVER 2000

为什么?

应该怎么解决?


分数不够可以再加呀!!!
 
这个问题呀,如果你在查询分析器中可以执行的话那么就说明你的SQL语句没有问题的,
你的后台是SQL server吧,你可以把你的sql语句中加一点换行来解决,
加点 #13进去就可以了,我以前也是这样的,
例如
sql:='insert tablename'
+#13+'(s),values(5)……
这样,反正呢意思就是说你把在SQL语句的换行地方自己手动加上#13
 
多人接受答案了。
 
顶部