想把去年的数据导入到今年来; SQL语句好用,DataBaseURL肯定对,
在query.Execute;发生错误 提示: 无效的连接字符串类型:Exception .
var
query : TQuery;
yearFrom ,yearTo : String;
begin
yearFrom := CBFrom.Text.Trim();
yearTo := CBTo.Text.Trim();
query := TQuery.Create(nil);
try
query.ConnectionString := 'DataBaseURL = Biz:\GJDLSCJYYYXT\SJK.Database';
query.CommandText := 'insert into T_TRADECOMPT(TheYear,ComptID,OrganizeID,ComptName,SuperiorComptID,ComptType,Flag,Module,ContractID,BranchName,ContractType) select '
+ yearTo
+ ',ComptID,OrganizeID,ComptName,SuperiorComptID,ComptType,Flag,Module,ContractID,BranchName,ContractType from T_TRADECOMPT where TheYear =' + yearFrom;
query.Execute;
//调试下,query.CommandText 的语句,用SQLPLUS试验,好用!!
{insert into T_TRADECOMPT(TheYear,ComptID,OrganizeID,ComptName,SuperiorComptID,
ComptType,Flag,Module,ContractID,BranchName,ContractType)
select 2008,ComptID,OrganizeID,ComptName,SuperiorComptID,ComptType,Flag,
Module,ContractID,BranchName,ContractType
from T_TRADECOMPT
where TheYear =2007
}
finally
query.Free;
end;
DataSetBrokerCFWH.DataSet.Refresh; |