(Convert(Char(10),A.mydate,102)+B.mystring) as myfield

解决方案 »

  1.   

    undefined function 'convert ' in expression 错误,我该任何?代码:
          temp_sqltext1:=' select A.weitsjbh as 委托试件编号,A.psw as 试件密码,B.yaoqiurq as 要求完成日期,Convert(Char(10),B.yaoqiurq,102)+B.project as 试验项目,A.taskbh,A.taskrq ';    //A.gongchbwyi
          temp_sqltext2:=' from "weitud"A,"wtinfo_huitan"B ';
          temp_sqltext3:=' where (A.cailmc=:yy) and (A.taskpflag=:mm) and (A.weiturq>=:kk) and (A.weiturq<=:jj) and (A.weitsjbh=B.weitsjbh)  ';
          sqltext:=temp_sqltext1+temp_sqltext2+temp_sqltext3;
          formatsqltext('回弹',sqltext);
      

  2.   

    上面说的适用于SqlServer数据库中,你用的是什么数据库?
      

  3.   

    genphone_ru 朋友,我该怎么做
      

  4.   

    能否 ('   '+B.project )As 试验项目 加空格
      

  5.   

    (Format(A.DateTime,'YYYY-MM-DD')+B.MyString) AS asd
      

  6.   

    我再试一下,非常感谢genphone_ru(票票)
      

  7.   

    试试这个(FormatDateTime('YYYY-MM-DD',A.DateTime)+B.MyString) AS asd
      

  8.   

    好的,能否在 B.MyString+'   ' as asd 加空格,如果可以我该怎么加
      

  9.   

    temp_sqltext2:=' from weitud A,wtinfo_huitan B ';
    当然可以加空格。
          
      

  10.   

    用FORMAT函数;
    Returns a Variant (String) containing an expression formatted according to instructions contained in a format expression.SyntaxFormat(expression[, format[, firstdayofweek[, firstweekofyear]]])The Format function syntax has these parts:Part Description
    expression Required. Any valid expression.
    format Optional. A valid named or user-defined format expression.
    firstdayofweek Optional. A constant that specifies the first day of the week.
    firstweekofyear Optional. A constant that specifies the first week of the year.
    SettingsThe firstdayofweek argument has these settings:Constant Value Description
    vbUseSystem 0 Use NLS API setting.
    VbSunday 1 Sunday (default)
    vbMonday 2 Monday
    vbTuesday 3 Tuesday
    vbWednesday 4 Wednesday
    vbThursday 5 Thursday
    vbFriday 6 Friday
    vbSaturday 7 Saturday
    The firstweekofyear argument has these settings:Constant Value Description
    vbUseSystem 0 Use NLS API setting.
    vbFirstJan1 1 Start with week in which January 1 occurs (default).
    vbFirstFourDays 2 Start with the first week that has at least four days in the year.
    vbFirstFullWeek 3 Start with the first full week of the year.
    ResTo Format Do This
    Numbers Use predefined named numeric formats or create user-defined numeric formats.
    Dates and times Use predefined named date/time formats or create user-defined date/time formats.
    Date and time serial numbers Use date and time formats or numeric formats.
    Strings Create your own user-defined string formats.
    If you try to format a number without specifying format, Format provides functionality similar to the Str function, although it is internationally aware. However, positive numbers formatted as strings using Format don抰 include a leading space reserved for the sign of the value; those converted using Str retain the leading space.This example shows various uses of the Format function to format values using both named formats and user-defined formats. For the date separator (/), time separator (:), and AM/ PM literal, the actual formatted output displayed by your system depends on the locale settings on which the code is running. When times and dates are displayed in the development environment, the short time format and short date format of the code locale are used. When displayed by running code, the short time format and short date format of the system locale are used, which may differ from the code locale. For this example, English/U.S. is assumed.MyTime and MyDate are displayed in the development environment using current system short time setting and short date setting.Dim MyTime, MyDate, MyStr
    MyTime = #17:04:23#
    MyDate = #January 27, 1993#' Returns current system time in the system-defined long time format.
    MyStr = Format(Time, "Long Time")' Returns current system date in the system-defined long date format.
    MyStr = Format(Date, "Long Date")MyStr = Format(MyTime, "h:m:s") ' Returns "17:4:23".
    MyStr = Format(MyTime, "hh:mm:ss AMPM") ' Returns "05:04:23 PM".MyStr = Format(MyDate, "dddd, mmm d yyyy") ' Returns "Wednesday,
    ' Jan 27 1993".
    ' If format is not supplied, a string is returned.
    MyStr = Format(23) ' Returns "23".' User-defined formats.
    MyStr = Format(5459.4, "##,##0.00") ' Returns "5,459.40".
    MyStr = Format(334.9, "###0.00") ' Returns "334.90".
    MyStr = Format(5, "0.00%") ' Returns "500.00%".MyStr = Format("HELLO", "<") ' Returns "hello".
    MyStr = Format("This is it", ">") ' Returns "THIS IS IT".