tabname:=(edit1.text);
 sqlstr:='Create table '+tabname+'( 时间 datetime not null,总电压 float not null,总电流 float not null,SOC float not null,采集板个数 float not null,板号 float not null,电压个数 float not null,温度个数 float not null,1电压 float not null,2电压 float not null,3电压 float not null,4电压 float not null,5电压 float not null,6电压 float not null,7电压 float not null,8电压 float not null,9电压 float not null,10电压 float not null,11电压 float not null,12电压 float not null,13电压 float not null,14电压 float not null,15电压 float not null,16电压 float not null,温度1 float not null,温度2 float not null,故障数 float not null,校验和 float not null )';
 ADOquery1.Close;
 ADOquery1.SQL.Clear;
 ADOquery1.SQL.Add(sqlstr);
 ADOquery1.ExecSQL;这里面的sqlstr太长了用什么类型呀?

解决方案 »

  1.   

    写成几个字符串相加的形式啊,如
    sqlstr := 'abc' + 'def' + ...或者直接用几次ADOquery1.SQL.Add,如
    ADOquery1.SQL.Add('abc');
    ADOquery1.SQL.Add('def');
    ...
      

  2.   


    sqlstr := 'Create table ' + tabname;
    sqlstr := sqlstr + '( 时间 datetime not null,';
    sqlstr := sqlstr + '总电压 float not null,';
    {……行数多了效果就出来了,很漂亮的。}
      

  3.   

    试试FmtStr函数呢?
    FmtStr(sql, 'Create table %s ( %s datetime not null,%s float not null,%s .... ', [TableName, Field1, Field2...]);不过你这表建立得中文做列名啊!不推荐这么用啊
      

  4.   

    sSql:=Format('Create...',[...]);
    看着方便
      

  5.   

    我也喜欢在拼接sql的时候用Format('', [])