private long GetMaxTransactionNum() { string sqlCommandGetMaxTransactionId = @"SELECT TOP 1 BitcoinTransaction.BitcoinTransactionId FROM BitcoinTransaction ORDER BY BitcoinTransactionId desc"; return(AdoNetLayer.ConvertDbValue <long>(adoNetLayer.ExecuteScalar(sqlCommandGetMaxTransactionId))); }
public bool DatabaseExists() { string connectionString = this.databaseConnection.MasterConnectionString; using (SqlConnection sqlConnection = new SqlConnection(connectionString)) { sqlConnection.Open(); AdoNetLayer adoNetLayer = new AdoNetLayer(sqlConnection); return AdoNetLayer.ConvertDbValue<int>(adoNetLayer.ExecuteScalar( "SELECT CASE WHEN EXISTS (SELECT * FROM sys.databases WHERE [Name] = @DatabaseName) THEN 1 ELSE 0 END AS DatabaseExists", AdoNetLayer.CreateInputParameter("@DatabaseName", SqlDbType.NVarChar, this.databaseConnection.DatabaseName))) == 1; } }
public bool DatabaseExists() { string connectionString = this.databaseConnection.MasterConnectionString; using (SqlConnection sqlConnection = new SqlConnection(connectionString)) { sqlConnection.Open(); AdoNetLayer adoNetLayer = new AdoNetLayer(sqlConnection); return(AdoNetLayer.ConvertDbValue <int>(adoNetLayer.ExecuteScalar( "SELECT CASE WHEN EXISTS (SELECT * FROM sys.databases WHERE [Name] = @DatabaseName) THEN 1 ELSE 0 END AS DatabaseExists", AdoNetLayer.CreateInputParameter("@DatabaseName", SqlDbType.NVarChar, this.databaseConnection.DatabaseName))) == 1); } }