日期:2014-05-18  浏览次数:20607 次

ORA-00923: 未找到预期 FROM 关键字
protected void Button1_Click(object sender, EventArgs e)
  {
 
   
  OracleConnection con = DB.createConnection();
  con.Open();

  string strSel = "select MC as 名称,GG as 规格,YT as 用途,SCCJ as 生产厂家,JG as 价格 QT as 其他 from TOOL2 where MC ='"; strSel += DropDownList1.SelectedItem.Text + "'";
  OracleCommand cmd = new OracleCommand(strSel, con);
   
  OracleDataAdapter da = new OracleDataAdapter();
  da.SelectCommand = cmd;
  DataSet ds = new DataSet();
  da.Fill(ds, "tool2");
  cmd.Connection.Open();
  OracleDataReader dr1=cmd.ExecuteReader();

  GridView1.DataSource = ds.Tables[0].DefaultView;
  GridView1.DataBind();
  }


这是本人的一个查询语句,运行时提示ORA-00923: 未找到预期 FROM 关键字,请大家帮忙

------解决方案--------------------
string strSel = "select MC as 名称,GG as 规格,YT as 用途,SCCJ as 生产厂家,JG as 价格 , QT as 其他 from TOOL2 where MC ='"; strSel += DropDownList1.SelectedItem.Text + "'"; 

------解决方案--------------------
漏了一个逗号

最好在sql server managerment stadio中调试好在放到代码中。