代码如下                string COnnectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=" + textBox_ip.Text + ")(PORT=1521))(CONNECT_DATA=(SID=orcl)));User Id=111;Password=111";
                OracleConnection conn = new OracleConnection(COnnectionString);
                conn.Open();
                OracleCommand cmd = new OracleCommand("select DAY_COMPLETE_DATE as 日期,WORK_CONTENT as 日清 from TP_DAY_COMPLETE where DAY_COMPLETE_DATE between to_date('" + Time1.Value.ToShortDateString() + "','yyyy-MM-dd') and to_date('" + Time2.Value.ToShortDateString() + "','yyyy-MM-dd') and PERSON_ID=  " + Id_textBox.Text + " ", conn);
                OracleDataAdapter oda = new OracleDataAdapter();
                oda.SelectCommand = cmd;
                System.Data.DataTable dt = new System.Data.DataTable();
                oda.Fill(dt);
                this.dataGridView1.DataSource = dt;
                conn.Close();
      本机上运行没问题,程序放在别的电脑上就提示ORA-0091错误,不解,求大神。

解决方案 »

  1.   

    就是一个button控件 代码都在这了。
      

  2.   

    OracleCommand cmd = new OracleCommand("select DAY_COMPLETE_DATE as 日期,WORK_CONTENT as 日清 from TP_DAY_COMPLETE where DAY_COMPLETE_DATE between to_date('" + Time1.Value.ToShortDateString() + "','yyyy-MM-dd') and to_date('" + Time2.Value.ToShortDateString() + "','yyyy-MM-dd') and PERSON_ID=  " + Id_textBox.Text + " ", conn);楼主把这句话中的sql部分打印出来,贴出来,或者在oracle环境中执行,看看有错误不
      

  3.   

    是不是PERSON_ID=  " + Id_textBox.Text + " ", 
    这里少了单引号
    PERSON_ID=  '" + Id_textBox.Text + "' ", 
      

  4.   

    PERSON_ID=  " + int.Parse(Id_textBox.Text) + "
    这样呢
      

  5.   

    ORA-0091? oracle 的 error message 编号应该是 5位数。给出正确的 ora-xxxxx 对错误追踪非常有帮助。
      

  6.   


    第一错误有问题。 缺少1位错误编码
    第二应当是你的SQL问题
    你可以运行之后 跟踪调试,把SQL贴出来单独到PLSQL执行
    看看能不能执行OK