public bool PemStatus(object o, string name, string PEM) { switch (PEM.ToUpper()) { case "P": System.Reflection.PropertyInfo pi = o.GetType().GetProperty(name); if (pi == null) return false; else return true; case "E": System.Reflection.EventInfo ei = o.GetType().GetEvent(name); if (ei == null) return false; else return true; case "M": System.Reflection.MethodInfo mi = o.GetType().GetMethod(name); if (mi == null) return false; else return true; default: return false; } }So this is like Naomi said, you're using reflection.
>>StringBuilder sb = new StringBuilder(); >>sb.Append("SELECT *"); >>sb.AppendFormat(" FROM {0}",YourTableName); >>sb.AppendFormat(" WHERE cName LIKE '{0}%'", WorkGroup); >>sb.AppendFormat(" AND dIntervalStart >= '{0}' AND dIntervalStart < '{1}'", StartDate, EndDate); >>sb.Append(" GROUP BY cName"); >>string sql = sb.ToString(); >> >>SqlConnection cn = new SqlConnection(SqlDataSource); >>SqlCommand cm = new SqlCommand(sql, cn); >>