예제 #1
0
        public AgentAwardRecord[] GetAgentAwardRecords(int agentID)
        {
            MySqlConnection myconn = null;
            MySqlCommand    mycmd  = null;

            try
            {
                string sqlText = "select * from agentawardrecord where AgentID = @AgentID";

                myconn = MyDBHelper.Instance.CreateConnection();
                myconn.Open();
                mycmd             = myconn.CreateCommand();
                mycmd.CommandText = sqlText;
                mycmd.Parameters.AddWithValue("@AgentID", agentID);

                MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd);
                DataTable        table   = new DataTable();
                adapter.Fill(table);
                var lists = MetaDBAdapter <AgentAwardRecord> .GetAgentAwardRecordFromDataTable(table);

                table.Clear();
                table.Dispose();
                adapter.Dispose();

                return(lists);
            }
            finally
            {
                if (mycmd != null)
                {
                    mycmd.Dispose();
                }
                if (myconn != null)
                {
                    myconn.Close();
                    myconn.Dispose();
                }
            }
        }