/// <summary>
/// 读取数据库中存在的数据
/// </summary>
/// <returns>返回获取的数据DataTable,如果出现异常则返回空</returns>
public DataTable ReadExistData()
{
string oradb = "Data Source=wnms;Persist Security Info=True;User ID=nmosdb;Password=nmosoptr";
try
{
OracleConnection conn = new OracleConnection(oradb);
conn.Open();
try
{
string sql = GetXmlString("db_data");
OracleCommand cmd = new OracleCommand(sql, conn);
cmd.CommandType = CommandType.Text;
//大容量数据,可以进行修改,使用DataSet和DataAdapter
DataSet ds = new DataSet();
OracleDataAdapter da = new OracleDataAdapter();
da.SelectCommand = cmd;
da.Fill(ds);
return ds.Tables[0];
}
catch (System.Exception ex)
{
return null;
}
}
catch (System.Exception ex)
{
return null;
}
}