Q&A

  • update 쿼리문 에러가 나네요,, 도와주세요,,
procedure TFequip_insert.BitBtn5Click(Sender: TObject);
begin
dm2.ADODataSet1.Close;
dm2.ADOConnection1.open;

        with DM2.ADOQuery16 do begin
        dm2.ADOQuery16.close;
        dm2.ADOQuery16.SQL.Clear;
        dm2.ADOQuery16.SQL.ADD(' select equ_large, equ_middle, equ_name, unitcost, equ_rule, depment, person, equ_state, building, room, nation, company_made, company_buy, company_repair, buydate, repairdate, ruler, useyear, lendyn, notecolumn, img from equ_content where equ_num = ''' + equ_num.Text + '''');
        open;
        first;
        end;

        With dm2.ADOQuery17 do Begin

        dm2.ADOQuery17.Close;
        dm2.ADOQuery17.SQL.Clear;
        dm2.ADOQuery17.SQL.Add('update equ_content SET equ_large   = :combobox1_class_name, equ_middle = :Combobox2_class_step1, equ_name = :combobox3_Class_step2, unitcost = :Edit6_unitcost, equ_rule = :Edit1_equ_rule, person = :Combobox25_person_name, equ_state = :combobox5_state_name, building = :combobox6_build_name, room = :combobox7_build_room, nation = :combobox8_nation_name, company_made = :combobox9_company_made, company_buy = :combobox10_company_buy, company_repair = :combobox11_company_repair, buydate = :buydate, repairdate = :edit4_repairdate, ruler = :combobox12_ruler_name, useyear = :edit5_useyear, lendyn = :checkbox2, notecolumn = :notecolumn WHERE equ_num = ''' + equ_num.text ''''); //이부분이 687부분입니다

        Parameters.ParamByName('equ_large') := combobox1_class_name.Text;
        Parameters.ParamByName('equ_middle') := combobox2_class_step1.Text;
        Parameters.ParamByName('equ_name') := combobox3_class_step2.Text;
        Parameters.ParamByName('unitcost') := Edit6_unitcost.Text;
        Parameters.ParamByName('equ_rule') := edit1_equ_rule.Text;
        Parameters.ParamByName('depment') := combobox4_dep_name.Text;
        Parameters.ParamByName('person') := combobox25_person_name.Text;
        Parameters.ParamByName('equ_state') := combobox5_state_name.Text;
        Parameters.ParamByName('building') := combobox6_build_name.Text;
        Parameters.ParamByName('room') := combobox7_build_room.Text;
        Parameters.ParamByName('nation') := combobox8_nation_name.Text;
        Parameters.ParamByName('company_made') := combobox9_company_made.Text;
        Parameters.ParamByName('company_buy') := combobox10_company_buy.Text;
        Parameters.ParamByName('company_repair') := combobox11_company_repair.Text;
        Parameters.ParamByName('buydate') := buydate.Text;
        Parameters.ParamByName('repairdate') := edit4_repairdate.Text;
        Parameters.ParamByName('ruler') := combobox12_ruler_name.Text;
        Parameters.ParamByName('useyear') := edit5_useyear.Text;
        Parameters.ParamByName('lendyn') := checkbox2.Text;
        Parameters.ParamByName('notecolumn') := notecolumn.Text;
        ExecSql;

   end;

        dm2.ADODataSet1.Open;

        if DM2.ADOQuery17.Active <> True then begin
        DM2.ADOQuery17.Active := True
        end;
  
end;

에러 메세지
[Error] Uinsert.pas(687): String literals may have at most 255 elements
라고 에러문이 나는데 아무래도 update쿼리문에 에러가 난것 같은데,,
잘모르겠어요,, ^^ 도와주시면 감사하겠습니다
2  COMMENTS
  • Profile
    이용운 2004.01.20 00:42
    update sql 문에 depment 필드가 빠졌네요..
    그리고..
    With dm2.ADOQuery17 do
            Begin
              Close;
              SQL.Clear;
              SQL.Add('update   equ_content
              SQL.Add('   SET   equ_large       = :combobox1_class_name       ');
              SQL.Add('        ,equ_middle      = :Combobox2_class_step1      ');
              SQL.Add('        ,equ_name        = :combobox3_Class_step2      ');
              SQL.Add('        ,unitcost        = :Edit6_unitcost             ');
              SQL.Add('        ,equ_rule        = :Edit1_equ_rule             ');
              SQL.Add('        ,person          = :Combobox25_person_name     ');
              SQL.Add('        ,equ_state       = :combobox5_state_name       ');
              SQL.Add('        ,building        = :combobox6_build_name       ');
              SQL.Add('        ,room            = :combobox7_build_room       ');
              SQL.Add('        ,nation          = :combobox8_nation_name      ');
              SQL.Add('        ,company_made    = :combobox9_company_made     ');
              SQL.Add('        ,company_buy     = :combobox10_company_buy     ');
              SQL.Add('        ,company_repair  = :combobox11_company_repair  ');
              SQL.Add('        ,buydate         = :buydate                    ');
              SQL.Add('        ,repairdate      = :edit4_repairdate           ');
              SQL.Add('        ,ruler           = :combobox12_ruler_name      ');
              SQL.Add('        ,useyear         = :edit5_useyear              ');
              SQL.Add('        ,lendyn          = :checkbox2                  ');
              SQL.Add('        ,notecolumn      = :notecolumn                 ');
              SQL.Add('WHERE   equ_num          = ''' + equ_num.text '''      '); //이부분이 687부분입니다

              Parameters.ParamByName('equ_large'     ) := combobox1_class_name.Text;
              Parameters.ParamByName('equ_middle'    ) := combobox2_class_step1.Text;
              Parameters.ParamByName('equ_name'      ) := combobox3_class_step2.Text;
              Parameters.ParamByName('unitcost'      ) := Edit6_unitcost.Text;
              Parameters.ParamByName('equ_rule'      ) := edit1_equ_rule.Text;
              Parameters.ParamByName('depment'       ) := combobox4_dep_name.Text;
              Parameters.ParamByName('person'        ) := combobox25_person_name.Text;
              Parameters.ParamByName('equ_state'     ) := combobox5_state_name.Text;
              Parameters.ParamByName('building'      ) := combobox6_build_name.Text;
              Parameters.ParamByName('room'          ) := combobox7_build_room.Text;
              Parameters.ParamByName('nation'        ) := combobox8_nation_name.Text;
              Parameters.ParamByName('company_made'  ) := combobox9_company_made.Text;
              Parameters.ParamByName('company_buy'   ) := combobox10_company_buy.Text;
              Parameters.ParamByName('company_repair') := combobox11_company_repair.Text;
              Parameters.ParamByName('buydate'       ) := buydate.Text;
              Parameters.ParamByName('repairdate'    ) := edit4_repairdate.Text;
              Parameters.ParamByName('ruler'         ) := combobox12_ruler_name.Text;
              Parameters.ParamByName('useyear'       ) := edit5_useyear.Text;
              Parameters.ParamByName('lendyn'        ) := checkbox2.Text;
              Parameters.ParamByName('notecolumn'    ) := notecolumn.Text;
              ExecSql;
           end;
    이렇게 정리한다면 소스가독성이 조금 높아지지 않을까 싶네여..

  • Profile
    강지형 2004.01.20 00:53
    ^^감사합니다,, 세심하게 프로그램 정리두 해주셔서요,, 즐거운 설 보내시길 바랄께여^^