一个很奇怪的错误,高手帮忙看一下
AnsiString str_sql = "create or replace and compile java source named "LinxUtil" as import java.io.*; ";
str_sql += " public class LinxUtil extends Object { public static String runCMD(String args) { try { ";
str_sql += " BufferedReader myReader= new BufferedReader(new InputStreamReader( Runtime.getRuntime().exec(args).getInputStream() ) ); ";
str_sql += " String stemp,str=""; while ((stemp = myReader.readLine()) != null) str +=stemp+" "; ";
str_sql += " myReader.close(); return str ; ";
str_sql += " } catch (Exception e) { return e.toString(); } } }";
ADOCommand1->CommandText = str_sql;
ADOCommand1->Execute();
连接的是oracle数据库,这一段程序在倒数第二行时,会报一个“未指定的错误”,最后一行时也出现一个这样的错误;
我把程序改为
AnsiString str_sql = "create or replace and compile java source named "LinxUtil" as import java.io.*; ";
str_sql += " public class LinxUtil extends Object { public static String runCMD(String args) { try { ";
str_sql += " BufferedReader myReader= new BufferedReader(new InputStreamReader( Runtime.getRuntime().exec(args).getInputStream() ) ); ";
str_sql += " String stemp,str=""; while ((stemp = myReader.readLine()) != null) str +=stemp+" "; ";
str_sql += " myReader.close(); return str ; ";
//str_sql += " } catch (Exception e) { return e.toString(); } } }";
ADOCommand1->CommandText = str_sql;
ADOCommand1->Execute();
时,倒数第二行时的错误就没有了,但是很显然,我需要这一行,请高手帮忙看看!!!
[解决办法]
paramcheck设置为false看看
[解决办法]
因为你的SQL代码中执行的是非查询语句, 所以最好是将参数检查关闭, 也就是将ParamCheck设为false