稀土 2017-12-05
static OracleConnection mQracleConnecting = null; public static OracleConnection QracleConnecting { get { try { if(mQracleConnecting ==null) mQracleConnecting = new OracleConnection(jksg); if (mQracleConnecting.State != ConnectionState.Open) mQracleConnecting.Open(); return mQracleConnecting; } catch (Exception) { return null; } } } public static DataTable DBGetDataTable(string sql,string conn) { DataTable dataSet = new DataTable(); OracleDataAdapter OraDA = new OracleDataAdapter(sql, conn); OraDA.Fill(dataSet); return dataSet; } public static DataTable DBGetDataTable(string sql, OracleConnection conn) { DataTable dataSet = new DataTable(); OracleDataAdapter OraDA = new OracleDataAdapter(sql, conn); OraDA.Fill(dataSet); return dataSet; } // 执行SQL语句,返回所影响的行数 public static int ExecuteSQL(string sql) { int Cmd = ; OracleCommand command = new OracleCommand(sql, QracleConnecting); try { Cmd = command.ExecuteNonQuery(); } catch { } return Cmd; } public static int ExecuteSQL_Update(string sql) { OracleDataAdapter OraDA = new OracleDataAdapter(sql, QracleConnecting); return OraDA.UpdateCommand.ExecuteNonQuery(); } public static int ExecuteSQL_Insert(string sql) { OracleDataAdapter OraDA = new OracleDataAdapter(sql, QracleConnecting); return OraDA.InsertCommand.ExecuteNonQuery(); }