public CodeGerneratorHelper() { String defaultConnection = ConfigFileTool.SAPGlobalSettings.GetSettingsFromDb(); db2 = new netlib7(defaultConnection); }
public CodeGerneratorHelper(String dbConnectionName) { db2 = new netlib7(dbConnectionName); }
public DbUtil(String dbConnectionName) { db2 = new netlib7(dbConnectionName); }
public DbUtil() { String defaultConnection = ConfigFileTool.SAPGlobalSettings.GetDefaultDbConnection(); db2 = new netlib7(defaultConnection); }
//把一个DATATABLE保存到数据库 public bool SaveDataTable(DataTable dt) { sendMessage("数据保存开始==========================>"); try { setDataTable(dt); } catch (Exception exception) { ErrorMessage = exception.Data + exception.StackTrace + exception.Message; // log.Error(ErrorMessage); sendMessage(exception.Message); return(false); } // String defaultDb = null; if (String.IsNullOrWhiteSpace(DbConnectionString)) { DbConnectionString = ConfigFileTool.SAPGlobalSettings.GetDefaultDbConnection(); } //defaultDb = ConfigFileTool.SAPGlobalSettings.GetDefaultDb(); if (string.IsNullOrWhiteSpace(DbConnectionString)) { sendMessage("没有配置默认的数据库连接!!"); throw new SAPException("没有配置默认的数据库连接!!"); } sendMessage("数据连接字符串:" + DbConnectionString); db2 = new netlib7(DbConnectionString); db2.LogEvents = true; try { bool isCreated = false; bool isExist = checkTableIsExist(); if (!_appendToDb || _newTable) { isCreated = CreateNewTable(); } else if (!isExist) { isCreated = CreateNewTable(); } if (!isCreated && !isExist) { return(false); } InserDataTableTodb(); sendMessage("数据结束开始==========================>"); this.ErrorMessage = db2.ErrorMessage; if (String.IsNullOrWhiteSpace(ErrorMessage)) { sendMessage("保存成功"); return(true); } else { sendMessage("出错啦" + ErrorMessage); } return(false); } catch (Exception exception) { ErrorMessage = exception.Data + exception.StackTrace + exception.Message; // log.Error(ErrorMessage); sendMessage(exception.Message); return(false); } }
public IdocDb(String pConnectionName) { this.ConnectionName = pConnectionName; logicDb = new netlib7(ConnectionName); }
public IdocDb() { this.ConnectionName = ConfigFileTool.SAPGlobalSettings.GetDefaultDbConnection(); logicDb = new netlib7(ConnectionName); }