读一段程序:
sql1 := 'insert into PM_XMRWS(RWSJC, RWSQC, HTZE, RJZE, XMZCB, ' + 
       'KHKSSJ, KHJSSJ, XMJL, XMJLLXDH, XMJLDZYX, HTJF, JFLXR, JFLXDH, '+ 
       'JFLXYX, XMSM, SFJT) values (''%s'', ''%s'', %f, %f, %f, #%s#, ' + 
       '#%s#, ''%s'', ''%s'', ''%s'', ''%s'', ''%s'', ''%s'', ''%s'', ' + 
       '''%s'', ''否'')';
想知道这其中的values里面的参数中的例如%s,%f,#%s#代表什么意思呀?

解决方案 »

  1.   

    The following table summarizes the possible values for type:d
    Decimal. The argument must be an integer value. The value is converted to a string of decimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has less digits, the resulting string is left-padded with zeros.u
    Unsigned decimal. Similar to 'd' but no sign is output.e
    Scientific. The argument must be a floating-point value. The value is converted to a string of the form "-d.ddd...E+ddd". The resulting string starts with a minus sign if the number is negative. One digit always precedes the decimal point.The total number of digits in the resulting string (including the one before the decimal point) is given by the precision specifier in the format string—a default precision of 15 is assumed if no precision specifier is present. The "E" exponent character in the resulting string is always followed by a plus or minus sign and at least three digits.f
    Fixed. The argument must be a floating-point value. The value is converted to a string of the form "-ddd.ddd...". The resulting string starts with a minus sign if the number is negative.The number of digits after the decimal point is given by the precision specifier in the format string—a default of 2 decimal digits is assumed if no precision specifier is present.g
    General. The argument must be a floating-point value. The value is converted to the shortest possible decimal string using fixed or scientific format. The number of significant digits in the resulting string is given by the precision specifier in the format string—a default precision of 15 is assumed if no precision specifier is present.Trailing zeros are removed from the resulting string, and a decimal point appears only if necessary. The resulting string uses fixed point format if the number of digits to the left of the decimal point in the value is less than or equal to the specified precision, and if the value is greater than or equal to 0.00001. Otherwise the resulting string uses scientific format.n
    Number. The argument must be a floating-point value. The value is converted to a string of the form "-d,ddd,ddd.ddd...". The "n" format corresponds to the "f" format, except that the resulting string contains thousand separators.m
    Money. The argument must be a floating-point value. The value is converted to a string that represents a currency amount. The conversion is controlled by the CurrencyString, CurrencyFormat, NegCurrFormat, ThousandSeparator, DecimalSeparator, and CurrencyDecimals global variables or their equivalent in a TFormatSettings data structure. If the format string contains a precision specifier, it overrides the value given by the CurrencyDecimals global variable or its TFormatSettings equivalent.p
    Pointer. The argument must be a pointer value. The value is converted to an 8 character string that represents the pointers value in hexadecimal.s
    String. The argument must be a character, a string, or a PChar value. The string or character is inserted in place of the format specifier. The precision specifier, if present in the format string, specifies the maximum length of the resulting string. If the argument is a string that is longer than this maximum, the string is truncated.x
    Hexadecimal. The argument must be an integer value. The value is converted to a string of hexadecimal digits. If the format string contains a precision specifier, it indicates that the resulting string must contain at least the specified number of digits; if the value has fewer digits, the resulting string is left-padded with zeros.
      

  2.   

    估计你的sql1只是一个格式化字符串,后边应该还有类似的的语句
    sql:=format(sql1,'jsfd','sdjf',13.4......);
    这样%s表示字符串的替换符,%f是小数的替换符,等等,有些类似c的printf中用到的格式化字符串,你查查format的帮助,应该就是这样。
      

  3.   

    上上楼说的应该是对的,我觉得是这么回事.我的代码就是这样的:
        begin
          {新建项目任务书}
          sql1 := 'insert into PM_XMRWS(RWSJC, RWSQC, HTZE, RJZE, XMZCB, ' +
            'KHKSSJ, KHJSSJ, XMJL, XMJLLXDH, XMJLDZYX, HTJF, JFLXR, JFLXDH, ' +
            'JFLXYX, XMSM, SFJT) values (''%s'', ''%s'', %f, %f, %f, #%s#, ' +
            '#%s#, ''%s'', ''%s'', ''%s'', ''%s'', ''%s'', ''%s'', ''%s'', ' +
            '''%s'', ''否'')';
          sql1 := Format(sql1, [edtShortName.Text, edtLongName.Text, ContractSum,
            SoftwareSum, TotalCost, DateToStr(dtpBeginTime.Date),
            DateToStr(dtpEndTime.Date), cbProjectManager.Text, edtPMPhone.Text,
            edtPMEmail.Text, edtCompany.Text, edtLinkMan.Text, edtLinkPhone.Text,
            edtLinkEmail.Text, memRe.Text]);
          Close;
          SQL.Clear;
          SQL.Add(sql1);
          ExecSQL;
          ShowMessage('项目任务书创建成功!');
        end
      

  4.   

    一般用于格式化字符串,%s中的s是string的意思,用于在该位置插入一段预定义的字符串资源。
      

  5.   

    想知道这其中的values里面的参数中的例如
    %s--字符型,
    %f--浮点
    #%s#--日期