我的问题是一样的...我有这个代码在我的db utils类中用于make查询。
public DataSet sqlCommandSelect(string command)
{
try
{
DataSet objDataSet = new DataSet();
string strOrders = command
SqlCommand objOrderCommand = new SqlCommand(strOrders, myConnection);
SqlDataAdapter objOrdAdapter = new SqlDataAdapter();
objOrdAdapter.SelectCommand = objOrderCommand;
objOrdAdapter.Fill(objDataSet);
objOrderCommand.Dispose();
objOrdAdapter.Dispose();
return objDataSet;
}
catch (Exception ex)
{
log.Error("sqlCommandSelect : " + command + " " + ex.Message + " " + ex.StackTrace);
return null;
}
}
现在我正在尝试进行此查询(在sql编辑器上运行很好)
SELECT * FROM
OPENQUERY(ORACDGMI,'SELECT * FROM CIC.ANAGRAFICA ')
ORACDGMI是一个链接服务器SQL / ORACLE
给我错误:
An error occurred while preparing a query for execution
有什么建议吗?