Forum > Packages and Libraries

SQL Parameter not Found

(1/1)

eldonfsr:
I don't know could be i must be resting and enjoy holy days but i still working, well i don't know
what i did wrong, i create a sql sentence with parameters but send me error parameter not found...
 just at first parameter assign value send me error...

the  code run i other app just copy i made changes ......



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---   TsqlmPL.close;    TsqlOdbc.close;    TsqlmPL.SQL.Text:='select * from lnk order by lnkid';    TsqlmpL.Open;    TsqlMPL.last;    TsqlOdbc.SQL.Text:='select * from lnk where lnkid >= :plnkid' ;    TsqlOdbc.ParamByName('plnkid').AsInteger:= TsqlMPL.FieldByName('lnkid').AsInteger;    TsqlOdbc.Open ;    if( not TsqlOdbc.Eof) then begin       TsqlOdbc.next;    end;     tsqlm.SQL.Text:='insert into lnk ( lnkid , lnksuid , LNKMFRPARTNUMBER , LNKMFRPNID, LNKMFRID, LNKPNID , LNKUNID , LNKpnpartnumber, LNKToPNID, LNKUse, LNKLeadtime, LNKChoice, LNKVendorPN, LNKVendorDesc, LNKAtQty, LNKRFQDate, LNKMinIncrement, LNKCurrentCost, LNKSetupCost, LNKRoHS, LNKRoHSDoc, LNKRoHSNote )  ';    tsqlm.SQL.Text:=tsqlm.SQL.Text+' Values ( :param1 , :param2 , :param3 , :param4 , :param5 , :PLNKPNID , :pLNKUNID , :pLNKpnpartnumber, :pLNKToPNID, :pLNKUse, :pLNKLeadtime, :pLNKChoice, :pLNKVendorPN, :pLNKVendorDesc, :pLNKAtQty, :pLNKRFQDate, :pLNKMinIncrement, :PLNKCurrentCost, :pLNKSetupCost, :pLNKRoHS, :pLNKRoHSDoc, :PLNKRoHSNote )';     while( not TsqlOdbc.EOF) do begin       tsqlmPN.SQL.Text:='select * from pn where pnid=:ppnid';      tsqlmPN.ParamByName('ppnid').AsInteger:=TsqlOdbc.FieldByName('LnkPnId').AsInteger;      tsqlmPN.open; //      showmessage(tsqlm.SQL.Text);      tsqlm.ParamByName(':param1').AsInteger:= TsqlOdbc.FieldByName('lnkid').AsInteger;//      tsqlm.ParamByName(':pLnkid').AsInteger   := TsqlOdbc.FieldByName('lnkid').AsInteger;      tsqlm.ParamByName(':param2').AsInteger := TsqlOdbc.FieldByName('lnksuid').AsInteger;      tsqlm.ParamByName(':param3').AsString:= TsqlOdbc.FieldByName('LNKMFRPARTNUMBER').AsString;      tsqlm.ParamByName(':param4').AsString:= TsqlOdbc.FieldByName('LNKMFRPNID').AsString;      tsqlm.ParamByName(':param5').AsInteger:= TsqlOdbc.FieldByName('LNKMFRID').AsInteger;      tsqlm.ParamByName(':pLNKPNID').AsInteger:= TsqlOdbc.FieldByName('LNKPNID').AsInteger;      tsqlm.ParamByName(':pLNKUNID').AsInteger:= TsqlOdbc.FieldByName('LNKUNID').AsInteger;      tsqlm.ParamByName(':pLNKpnpartnumber').AsString:= TsqlMPN.FieldByName('pnpartnumber').AsString;      tsqlm.ParamByName(':pLNKToPNID').AsInteger:= TsqlOdbc.FieldByName('LNKToPNID').AsInteger;      tsqlm.ParamByName(':pLNKUse').AsInteger:= TsqlOdbc.FieldByName('LNKUse').AsInteger;      tsqlm.ParamByName(':pLNKLeadtime').AsString:= TsqlOdbc.FieldByName('LNKLeadtime').AsString;      tsqlm.ParamByName(':pLNKChoice').AsInteger:= TsqlOdbc.FieldByName('LNKChoice').AsInteger;      tsqlm.ParamByName(':pLNKChoice').AsString:= TsqlOdbc.FieldByName('LNKChoice').AsString;      tsqlm.ParamByName(':pLNKVendorDesc').AsString:= TsqlOdbc.FieldByName('LNKVendorDesc').AsString;      tsqlm.ParamByName(':pLNKAtQty').AsFloat:= TsqlOdbc.FieldByName('LNKAtQty').AsFloat;      tsqlm.ParamByName(':pLNKRFQDate').AsString:= TsqlOdbc.FieldByName('LNKRFQDate').AsString;      tsqlm.ParamByName(':pLNKMinIncrement').AsFloat:= TsqlOdbc.FieldByName('LNKMinIncrement').AsFloat;      tsqlm.ParamByName(':pLNKCurrentCost').AsFloat:= TsqlOdbc.FieldByName('LNKCurrentCost').AsFloat;      tsqlm.ParamByName(':pLNKSetupCost').AsFloat:= TsqlOdbc.FieldByName('LNKSetupCost').AsFloat;      tsqlm.ParamByName(':pLNKRoHS').AsInteger:= TsqlOdbc.FieldByName('LNKRoHS').AsInteger;      tsqlm.ParamByName(':pLNKRoHSDoc').AsString:= TsqlOdbc.FieldByName('LNKRoHSDoc').AsString;      tsqlm.ParamByName(':pLNKRoHSNote').AsString:= TsqlOdbc.FieldByName('LNKRoHSNote').AsString;       tsqlm.ExecSQL;      tsqlmc.close;      tsqlmpn.close;      TsqlOdbc.next;     end;     TsqlmPL.close;    TsqlOdbc.close;    TsqlmPL.SQL.Text:='select * from su order by suid';    TsqlmpL.Open;    TsqlMPL.last;    TsqlOdbc.SQL.Text:='select * from su where suid >= :psuid' ;    TsqlOdbc.ParamByName('psuid').AsInteger:= TsqlMPL.FieldByName('suid').AsInteger;    TsqlOdbc.Open ;    if( not TsqlOdbc.Eof) then begin       TsqlOdbc.next;    end;    while( not TsqlOdbc.EOF) do begin       tsqlmpl.SQL.Text:='insert into su ( suid, SUSupplier, SUAddress , SUCountry, SUPhone1, SUPhone2, SUFAX, SUWeb, SUContact1, SUContact2, SUDateLast , SUFollowup, SUNotes, SUCode, SUAccount, SUTerms , SUFedTaxID, SUStateTaxID, SUEMail1 , SUEMail2, SUCURID, SUCurDedExRate, SUCurExRate , SUCurReverse, SUNoPhonePrefix )';       tsqlmpl.SQL.Text:=tsqlmpl.SQL.Text+'values( :psuid, :pSUSupplier, :pSUAddress , :pSUCountry, :pSUPhone1, :pSUPhone2, :pSUFAX, :pSUWeb, :pSUContact1, :pSUContact2, :pSUDateLast , :pSUFollowup, :pSUNotes, :pSUCode, :pSUAccount, :pSUTerms ,:PSUFedTaxID, :pSUStateTaxID, :pSUEMail1 , :pSUEMail2, :pSUCURID, :PSUCurDedExRate, :pSUCurExRate , :pSUCurReverse, :PSUNoPhonePrefix ) ';       tsqlmpl.ParamByName('psuid').AsInteger:= tsqlodbc.FieldByName('suid').AsInteger;       tsqlmpl.ParamByName('psusupplier').AsString:= tsqlodbc.FieldByName('susupplier').AsString;       tsqlmpl.ParamByName('pSUAddress').AsString:= tsqlodbc.FieldByName('SUAddress').AsString;       tsqlmpl.ParamByName('pSUCountry').AsString:= tsqlodbc.FieldByName('SUCountry').AsString;       tsqlmpl.ParamByName('pSUPhone1').AsString:= tsqlodbc.FieldByName('SUPhone1').AsString;       tsqlmpl.ParamByName('pSUPhone2').AsString:= tsqlodbc.FieldByName('SUPhone2').AsString;       tsqlmpl.ParamByName('pSUFax').AsString:= tsqlodbc.FieldByName('SUFax').AsString;       tsqlmpl.ParamByName('pSUweb').AsString:= tsqlodbc.FieldByName('SUweb').AsString;       tsqlmpl.ParamByName('pSUContact1').AsString:= tsqlodbc.FieldByName('SUContact1').AsString;       tsqlmpl.ParamByName('pSUContact2').AsString:= tsqlodbc.FieldByName('SUContact2').AsString;       tsqlmpl.ParamByName('pSUDateLast').AsString:= FormatDateTime('yyyy-mm-dd',tsqlodbc.FieldByName('SUDateLast').AsDateTime);       tsqlmpl.ParamByName('pSUFollowup').AsBoolean:= tsqlodbc.FieldByName('SUFollowup').AsBoolean;       tsqlmpl.ParamByName('pSUNotes').AsString:= tsqlodbc.FieldByName('SUNotes').AsString;       tsqlmpl.ParamByName('pSUcode').AsString:= tsqlodbc.FieldByName('SUCode').AsString;       tsqlmpl.ParamByName('pSUAccount').AsString:= tsqlodbc.FieldByName('SUACcount').AsString;       tsqlmpl.ParamByName('pSUTerms').AsString:= tsqlodbc.FieldByName('SUTerms').AsString;       tsqlmpl.ParamByName('pSUFedTaxID').AsString:= tsqlodbc.FieldByName('SUFedTaxID').AsString;       tsqlmpl.ParamByName('pSUStateTaxID').AsString:= tsqlodbc.FieldByName('SUStateTaxID').AsString;       tsqlmpl.ParamByName('pSUEMail1').AsString:= tsqlodbc.FieldByName('SUEMail1').AsString;       tsqlmpl.ParamByName('pSUEMail2').AsString:= tsqlodbc.FieldByName('SUEMail2').AsString;       tsqlmpl.ParamByName('pSUCURID').AsInteger:= tsqlodbc.FieldByName('SUCURID').AsInteger;       tsqlmpl.ParamByName('pSUCurDedExRate').AsBoolean:= tsqlodbc.FieldByName('SUCurDedExRate').AsBoolean;       tsqlmpl.ParamByName('pSUCurExRate').AsFloat:= tsqlodbc.FieldByName('SUCurExRate').AsFloat;       tsqlmpl.ParamByName('pSUCurReverse').AsBoolean:= tsqlodbc.FieldByName('SUCurReverse').AsBoolean;       tsqlmpl.ParamByName('pSUNoPhonePrefix').AsBoolean:= tsqlodbc.FieldByName('SUNoPhonePrefix').AsBoolean;       tsqlmPL.ExecSQL;      tsqlmc.close;      tsqlmpn.close;      TsqlOdbc.next;     end;    

dseligo:
When you specify named parameter you don't put colon in front of parameter name, do it like this:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---tsqlm.ParamByName('param1').AsInteger:= TsqlOdbc.FieldByName('lnkid').AsInteger;
Why do you have &#39; instead of single quotes?

P.S.: Oh, it's something with the forum.

eldonfsr:
Ok  thanks for you help well I made changes but send me error

fmain.pas(449,23) Fatal: Syntax error, "identifier" expected but "#" found

on this like
  TsqlmPL.SQL.Text:=&#39;select * from lnk order by lnkid&#39;;

some unit need

eldonfsr:
Wow i see my big mistake could by i was so tired and  i don't see my error


was correct  why i put semicolon in front of parameter.

  tsqlm.Params.ParamByName('plnksuid').AsInteger := TsqlOdbc.FieldByName('lnksuid').AsInteger; 

is the correct instruction...

thanks for your help and sorry.....

Navigation

[0] Message Index

Go to full version