public static bool ActionExecuteStoreProcedureForDR(class_data_PlatformDBConnection activeconnection, class_Data_SqlSPEntry activeSPEntry, out class_data_PlatformDBDataReader refDataReader) { refDataReader = null; try { if (activeSPEntry == null) { return(false); } else { if (activeconnection != null && activeconnection.activeDatabaseType == enum_DatabaseType.SqlServer) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = activeSPEntry.SPName; cmd.CommandType = CommandType.StoredProcedure; foreach (SqlParameter activeParameter in ((class_data_SqlServerSPEntry)activeSPEntry).GetActiveParametersList()) { cmd.Parameters.Add(activeParameter); } cmd.Connection = ((class_data_SqlServerConnectionItem)activeconnection).ActiveConnection; refDataReader = new class_data_PlatformDBDataReader(); refDataReader.activeDatabaseType = enum_DatabaseType.SqlServer; ((class_data_SqlServerDataReader)refDataReader).ActiveDataReader = cmd.ExecuteReader(); return(true); } else if (activeconnection != null && activeconnection.activeDatabaseType == enum_DatabaseType.MySql) { MySqlCommand cmd = new MySqlCommand(); cmd.CommandText = activeSPEntry.SPName; cmd.CommandType = CommandType.StoredProcedure; foreach (MySqlParameter activeParameter in ((class_data_MySqlSPEntry)activeSPEntry).GetActiveParametersList()) { cmd.Parameters.Add(activeParameter); } cmd.Connection = ((class_data_MySqlConnectionItem)activeconnection).ActiveConnection; refDataReader = new class_data_PlatformDBDataReader(); refDataReader.activeDatabaseType = enum_DatabaseType.MySql; ((class_data_MySqlDataReader)refDataReader).ActiveDataReader = cmd.ExecuteReader(); return(true); } else { return(false); } } } catch { return(false); } }
public static bool ActionExecuteForDR(class_data_PlatformDBConnection activeconnection, string executeSql, out class_data_PlatformDBDataReader refDataReader) { refDataReader = null; try { if (executeSql == "") { return(false); } else { if (activeconnection != null) { if (activeconnection.activeDatabaseType == enum_DatabaseType.SqlServer) { SqlCommand cmd = new SqlCommand(executeSql); cmd.Connection = ((class_data_SqlServerConnectionItem)activeconnection).ActiveConnection; refDataReader = new class_data_PlatformDBDataReader(); refDataReader.activeDatabaseType = enum_DatabaseType.SqlServer; ((class_data_SqlServerDataReader)refDataReader).ActiveDataReader = cmd.ExecuteReader(); return(true); } else if (activeconnection.activeDatabaseType == enum_DatabaseType.MySql) { MySqlCommand cmd = new MySqlCommand(executeSql); cmd.Connection = ((class_data_MySqlConnectionItem)activeconnection).ActiveConnection; refDataReader = new class_data_PlatformDBDataReader(); refDataReader.activeDatabaseType = enum_DatabaseType.MySql; ((class_data_MySqlDataReader)refDataReader).ActiveDataReader = cmd.ExecuteReader(); return(true); } else { return(false); } } else { return(false); } } } catch { return(false); } }