当前位置:编程学习 > C#/ASP.NET >>

Delphi 问题


sSQL := '0SELECT FILEDNAME, headname FROM CMPPS150_CRTL ' +
    ' WHERE  NCMP=' + QuotedStr(UserCOM) + '' +
    ' AND MAPPING_TYPE=' + QuotedStr(DDATATYPE.Items[DDATATYPE.ItemIndex]) + '';
  If Not CDS_OPEN(cds_tmp, sSQL) Then
    Begin
      PPSwarning_Msg('data exist!!');
      EXIT;
    End;
  While Not cds_tmp.Eof Do
    Begin
      filedname := filedname + ',' + cds_tmp.FieldByName('filedname').asString + '';
      cds_tmp.next;
    End;

  sSQL := 'INSERT INTO CMPPS151 ' +
    ' (NCMP,MAPPING_TYPE,' + Copy(filedname, 2, length(filedname)) + ')' +
    ' VALUES ' +
    '(' + QuotedStr(UserCOM) + ',' +
    '' + QuotedStr(trim(DDATATYPE.text)) + ',' +
    IIF(QuotedStr(trim(Edit_1.text)) <> '', '' + QuotedStr(trim(Edit_1.text)) + '', '') + ', ' +
    IIF(QuotedStr(trim(Edit_2.text)) <> '', '' + QuotedStr(trim(Edit_2.text)) + '', '') + ', ' +
    IIF(QuotedStr(trim(Edit_3.text)) <> '', '' + QuotedStr(trim(Edit_3.text)) + '', '') + ', ' +
    IIF(QuotedStr(trim(Edit_4.text)) <> '', '' + QuotedStr(trim(Edit_4.text)) + '', '') + ', ' +
    IIF(QuotedStr(trim(Edit_5.text)) <> '', '' + QuotedStr(trim(Edit_5.text)) + '', '') + ', ' +
    IIF(QuotedStr(trim(Edit_6.text)) <> '', '' + QuotedStr(trim(Edit_6.text)) + '', '') + ', ' +
    IIF(QuotedStr(trim(Edit_7.text)) <> '', '' + QuotedStr(trim(Edit_7.text)) + '', '') + ', ' +
    IIF(QuotedStr(trim(Edit_8.text)) <> '', '' + QuotedStr(trim(Edit_8.text)) + '', '') + ' )';
  If cds_execute(cds_tmp, sSQL) Then
    Begin
      cds_CMPPS218 := CDS_Create(CMS);
      cds_Tmp := CDS_Create(CMS);
      PPSwarning_Msg('Insert Compete DATE SUCCEED! ');
      Filldg218();
      Clear();
    End
  Else
    Begin
      PPSError_Msg('Insert fail!');
    End;

最后的到的sql是这样的:
INSERT INTO CMPPS151  (NCMP,MAPPING_TYPE,COL_01,COL_02,COL_03,COL_04,COL_05)
 VALUES ('F311','SUSAN_PLT_QTY','23','23','23','23','23','',''',''' ''')

可是我想得到的是:INSERT INTO CMPPS151  (NCMP,MAPPING_TYPE,COL_01,COL_02,COL_03,COL_04,COL_05)
 VALUES ('F311','SUSAN_PLT_QTY','23','23','23','23','23')
这个是读取出来的COL_01,COL_02,COL_03,COL_04,COL_05
一共是8个,读到几个在录入的文本框就显示几个,也就只能录入几个 没有的就不能录入。。。请问大家有什么好的方法
  --------------------编程问答-------------------- --------------------编程问答-------------------- 去Delphi板块
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,