我想查找 表 油井参数区L7-3366 里面的记录。
string sql = "select * from '油井参数区L7-3366'"; 这样为什么不行???

解决方案 »

  1.   

    不行Oracle的写法select '油井参数区L7-3366' from dual;Mysql的写法select '油井参数区L7-3366';
      

  2.   

    select * from '油井参数区L7-3366'应该是双引号
      

  3.   

    select * from 油井参数区L7-3366; 
    select * from "油井参数区L7-3366"; 
      

  4.   

    oracle    select t.* from 你好 t 
      

  5.   

    select t.* from 油井参数区L7-3366 t; 
      

  6.   

    select t.* from '油井参数区L7-3366' t;
      

  7.   

    應試是  string sql = "select * from 油井参数区L7-3366" 吧  我
      

  8.   

    應試是  string sql = "select * from 油井参数区L7-3366" 吧 
      

  9.   

    在visual studio 2005里面C#
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Data.OracleClient;
    public partial class lgb_try : System.Web.UI.Page
    {
        DataSet ds;
            public OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["lgb_try"].ToString());
        protected void Page_Load(object sender, EventArgs e)
        {
                   string sql = "select * from ''油井参数区L7-3366'";
            conn.Open();
            OracleDataAdapter da = new OracleDataAdapter(sql, conn);
            ds = new DataSet();
            da.Fill(ds);        GridView2.DataSource = ds;        GridView2.DataBind();        conn.Close();    }
    }
      

  10.   

    string sql = "select * from ''油井参数区L7-3366'"
    string sql = "select * from \"油井参数区L7-3366\""试试
    用转义字符\
      

  11.   

    12楼说得对。
     string bm = "油井参数区L6-3411";
     string sql = "select * from \"" + bm + "\"";或者       // string sql = "select * from \"油井参数区L6-3411\"";
    只是有点复杂了。
    谢谢!