public ExpChangeRecord[] GetExpChangeRecord(int userID) { ExpChangeRecord[] records = null; MySqlConnection myconn = null; try { DataTable dt = new DataTable(); myconn = MyDBHelper.Instance.CreateConnection(); myconn.Open(); MySqlCommand mycmd = myconn.CreateCommand(); string sqlTextA = "select a.*, b.UserName from expchangerecord a left join playersimpleinfo b on a.UserID = b.id where UserID = @UserID; "; mycmd.CommandText = sqlTextA; mycmd.Parameters.AddWithValue("@UserID", userID); MySqlDataAdapter adapter = new MySqlDataAdapter(mycmd); adapter.Fill(dt); if (dt != null) { records = MetaDBAdapter <ExpChangeRecord> .GetExpChangeRecordListFromDataTable(dt); } dt.Clear(); dt.Dispose(); adapter.Dispose(); mycmd.Dispose(); return(records); } finally { MyDBHelper.Instance.DisposeConnection(myconn); } }