设个断点看一下,把String 内的内容Copy到SQL查询分析器内执行,如果没问题就可能是你的代码有问题了,把你的代码copy出来看一下...

解决方案 »

  1.   

    your sqlstring = 
    begin
       sql1;
       sql2;
       sql3;
    end;
      

  2.   

    我是采用文件写好sql语句,然后用程序来导入sql到oracle中
    代码也没问题,请看执行到 oracleComm.ExecuteNonQuery();出错,提示无效字符Oracle.sql文件sql语句:create table TReceive (
    id number(10,2) not null,
    smobileno varchar2(20) null,
    sexno varchar2(20) null,
    ssmsmessage varchar2(140) null,
    dreturntime date null,
    sposition varchar2(20) null,
    dreceivetime date null,
    nreadtag char(1) default 0 null,
    dreadtime date null, constraint TReceive_pk primary key (id) );

    create table TSmsSendCache (
    id number(10,2) not null,
    ssender varchar(20) null,
    dbegintime date null,
    ntimingtag char(1) default 0 null,
    dtimingtime date null,
    ncontenttype number(38,0) default 101 null,
    sexno varchar2(20) null,
    ssendno clob null,
    ssmsmessage clob null, constraint TSmsSendCache_pk primary key (id) );代码: StringBuilder strSql = new StringBuilder(); //设置sql命令
                    string strConn = "Data Source=" + txtService.Text.Trim() + ";User Id=" + txtUser.Text.Trim() + ";password=" + txtPwd.Text.Trim() + ";Unicode=True";
                    OracleConnection oracleConn = new OracleConnection(strConn);                //用文件中导入sql代码到数据库中
                    StreamReader reader = new StreamReader(Application.StartupPath + "\\SqlFile\\Oracle.sql", Encoding.GetEncoding("gb2312"));
                    strSql.Append(reader.ReadToEnd());
                    OracleCommand oracleComm = new OracleCommand(strSql.ToString(), oracleConn);                oracleConn.Open();
                    oracleComm.ExecuteNonQuery();
                    oracleConn.Close();
      

  3.   

    your sqlstring = 
    begin
       sql1;
       sql2;
       sql3;
    end;这个方法试过了,还是错出