/// <summary> /// Convert IDataReader To HotKeyWordInfo /// </summary> /// <param name="reader"></param> /// <returns></returns> public static HotKeyWordInfo SetValue(IDataReader reader) { HotKeyWordInfo info = new HotKeyWordInfo(); int keyWordIndex = reader.GetOrdinal("KeyWord"); int cateIDIndex = reader.GetOrdinal("CateID"); int orderIDIndex = reader.GetOrdinal("OrderID"); info.KeyWord = reader.GetString(keyWordIndex); info.CateID = reader.GetInt32(cateIDIndex); info.OrderID = reader.GetInt32(orderIDIndex); return info; }
public bool Insert(HotKeyWordInfo hotKeyWordInfo) { StringBuilder sql=new StringBuilder(); sql.Append("INSERT INTO"); sql.Append(" [Tbl_HotKeyWord]("); sql.Append("[KeyWord],"); sql.Append("[CateID],"); sql.Append("[OrderID]"); sql.Append(") VALUES("); sql.Append("@KeyWord,"); sql.Append("@CateID,"); sql.Append("@OrderID"); sql.Append(")"); using(NetShopHelper dbhelper=new NetShopHelper()) { IDbDataParameter[] p_Parms=new IDbDataParameter[]{ dbhelper.CreateParameter("@KeyWord",hotKeyWordInfo.KeyWord), dbhelper.CreateParameter("@CateID",hotKeyWordInfo.CateID), dbhelper.CreateParameter("@OrderID",hotKeyWordInfo.OrderID) }; return 0 < dbhelper.ExecuteNonQuery(sql.ToString(),p_Parms); } }