求助:连接远程LINUX主机 ORACLE 数据库 异常:System.InvalidOperationException:......
异常信息 --------------------------
代码:using System.Data.OleDb;
using System;
using System.Data;
using System.Data.OracleClient;
//新建一个类(用于数据库连接的参数):
public class TestTool{
public static void Main(string[] args){
#region 查询命令组合
string cmdstr0="select id as \"内容编号\",content_name as \"内容名称\",";
string cmdstr1="decode(notificationstatus,0,'待确认',1,'注入中',2,'注入成功',3,'注入失败',4,'不注入',5,'待注入') as \"注入状态\" ,";
string cmdstr2="create_time as \"创建时间\",decode(contenttype,1,'文本',2,'图片',3,'视频',4,'媒体') as \"类型\"";
string cmdstr3="from t_content_xtv t where t.id='@ContentID'";
string cmdStr4=cmdstr0+cmdstr1+cmdstr2+cmdstr3;
Console.WriteLine("内容编号:");
string ContentId=Console.ReadLine();
string cmdStr=cmdStr4.Replace("@ContentID",ContentId);
#endregion
DataSet ds=getDS(cmdStr);
if(ds!=null)
for(int i=0;i<ds.Tables[0].Rows.Count;i++){
for(int j=0;i<ds.Tables[0].Columns.Count;j++){
Console.Write(ds.Tables[0].Rows[i][j] + " ");
}
Console.WriteLine();
}
else
Console.WriteLine("没有查找到匹配项");
}
static string GetOracleDbConnStr()
{
// 数据库连接
#region
string tempUser="adm",tempPassword="adm";
//string m1="(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)";
//string m2="(HOST = 192.168.7.114)(PORT = 1521)))(CONNECT_DATA =(SERVICE_NAME = wad114) )) ";
//string tempDataSource=m1+m2;
string tempDataSource="appdb_wad114";
string tempstrCon="Provider=OraOLEDB.Oracle.1;Persist Security Info=False;"+
"User ID="+tempUser+";Password="+tempPassword+";Data Source="+tempDataSource;
return tempstrCon;
#endregion
}
//设置Click事件:
static DataSet getDS(string cmdStr)
{
DataSet ds=new DataSet();
string tempstrCon=GetOracleDbConnStr();
string tempstrCom=cmdStr;
OleDbConnection tempmyConn=new OleDbConnection(tempstrCon);
tempmyConn.Open();
OleDbDataAdapter da=new OleDbDataAdapter (tempstrCom,tempmyConn);
da.Fill(ds);
tempmyConn.Close();
return ds;
}
-----------------------远程主机LINUX
ORACLE数据库 这么会有这个异常的(⊙o⊙)?
}
百度 GOOGLE 了很久 没解决
劳烦各位大神 看一下 谢谢