public RouletteAwardItem[] GetCurrentRouletteAwardItemsList() { RouletteAwardItem[] items = null; MySqlConnection myconn = null; MySqlCommand mycmd = null; try { myconn = MyDBHelper.Instance.CreateConnection(); myconn.Open(); string sqlText = "select c.`Index`, c.`AwarditemID`, r.* from currentrouletteawarditemlist c left join rouletteawarditem r on c.`AwarditemID` = r.`id` ;"; mycmd = myconn.CreateCommand(); mycmd.CommandText = sqlText; MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); DataTable table = new DataTable(); adapter.Fill(table); items = MetaDBAdapter <RouletteAwardItem> .GetRouletteAwardItemFromDataTable(table); table.Clear(); table.Dispose(); adapter.Dispose(); return(items); } finally { if (mycmd != null) { mycmd.Dispose(); } if (myconn != null) { myconn.Close(); myconn.Dispose(); } } }
public RouletteAwardItem[] GetAllRouletteAwardItems() { RouletteAwardItem[] items = null; MySqlConnection myconn = null; MySqlCommand mycmd = null; try { myconn = MyDBHelper.Instance.CreateConnection(); myconn.Open(); string sqlText = "select * from rouletteawarditem"; mycmd = myconn.CreateCommand(); mycmd.CommandText = sqlText; MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); DataTable table = new DataTable(); adapter.Fill(table); items = MetaDBAdapter <RouletteAwardItem> .GetRouletteAwardItemFromDataTable(table); table.Clear(); table.Dispose(); adapter.Dispose(); return(items); } finally { if (mycmd != null) { mycmd.Dispose(); } if (myconn != null) { myconn.Close(); myconn.Dispose(); } } }