public Tag FindByTagName(String tagName) { DataTable dt = m_SqliteOpera.Query("select * from tag where name='" + tagName + "'"); Tag tag = null; foreach (DataRow dr in dt.Rows) { tag = DataRowToTag(dr); break; } return(tag); }
public List <Tag> FindByHostId(int HostId) { DataTable dtTag = m_SqliteOpera.Query("select t.id as tag_id, t.name as tag_name from tag t, host_tag ht where ht.tag_id=t.id and ht.host_id=" + HostId); List <Tag> TagList = new List <Tag>(); foreach (DataRow dr in dtTag.Rows) { Tag tag = new Tag(Convert.ToInt32(dr["tag_id"]), Convert.ToString(dr["tag_name"])); TagList.Add(tag); } return(TagList); }