public RouletteRoundInfo GetLastRouletteRoundInfo() { MySqlConnection myconn = null; MySqlCommand mycmd = null; try { myconn = MyDBHelper.Instance.CreateConnection(); myconn.Open(); string sqlText = "select * from rouletteroundinfo order by id desc limit 1 ;"; mycmd = myconn.CreateCommand(); mycmd.CommandText = sqlText; MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); DataTable table = new DataTable(); adapter.Fill(table); var items = MetaDBAdapter <RouletteRoundInfo> .GetRouletteRoundInfoFromDataTable(table); table.Clear(); table.Dispose(); adapter.Dispose(); if (items == null || items.Length == 0) { return(null); } return(items[0]); } finally { if (mycmd != null) { mycmd.Dispose(); } if (myconn != null) { myconn.Close(); myconn.Dispose(); } } }
public RouletteRoundInfo[] GetAllRouletteRoundInfo() { MySqlConnection myconn = null; MySqlCommand mycmd = null; try { myconn = MyDBHelper.Instance.CreateConnection(); myconn.Open(); string sqlText = "select * from rouletteroundinfo ;"; mycmd = myconn.CreateCommand(); mycmd.CommandText = sqlText; MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); DataTable table = new DataTable(); adapter.Fill(table); var items = MetaDBAdapter <RouletteRoundInfo> .GetRouletteRoundInfoFromDataTable(table); table.Clear(); table.Dispose(); adapter.Dispose(); return(items); } finally { if (mycmd != null) { mycmd.Dispose(); } if (myconn != null) { myconn.Close(); myconn.Dispose(); } } }