public static bool CheckTable(string tableName) { string sql = SQL_SELECT_EXISTSTABLE.Replace("@tableName", tableName); int drow = ServiceDBHelper.ExcuteSql(sql); return(drow == 0 ? false : true); }
public int InsertContent(TalkContent tc, string nick) { SqlParameter[] param = CreateParameter(tc); string sql = SQL_INSERT.Replace("@tableName", DBHelper.GetRealTable("TalkContent", DataHelper.Encrypt(nick))); return(ServiceDBHelper.ExcuteSql(sql, param)); }
public void DropTable(string tableName) { if (CheckTable(tableName)) { string sql = SQL_DROP_TABLE.Replace("@tableName", tableName); ServiceDBHelper.ExcuteSql(sql); } ServiceDBHelper.ExcuteSql(SQL_CREATE_TABLE); }
public int UpdateNickShop(string nick, string shopId) { SqlParameter[] param = new[] { new SqlParameter("@ShopId", shopId), new SqlParameter("@nick", nick) }; return(ServiceDBHelper.ExcuteSql(SQL_UPDATE_SHOPID, param)); }
/// <summary> /// 用户订购获取代码时生成一张表 /// </summary> /// <param name="nickNo">加密后的</param> public void CreateTable(string nickNo) { string sql = SQL_SELECT_TABLE_EXISTS.Replace("@tableName", DBHelper.GetRealTable("TalkContent", nickNo)); int drow = ServiceDBHelper.GetScaleSql(sql); if (drow == 0) { sql = SQL_CREATE_TABLE.Replace("@tableName", DBHelper.GetRealTable("TalkContent", nickNo)).Replace("@pk", "PK_TalkContent_" + nickNo); ServiceDBHelper.ExcuteSql(sql); } }
public int UpdateGoodsInfo(GoodsInfo info) { SqlParameter[] param = new[] { new SqlParameter("@GoodsId", info.num_iid), new SqlParameter("@CId", info.cid), new SqlParameter("@GoodsName", info.title), new SqlParameter("@Pic_Url", info.pic_url), new SqlParameter("@GoodsPrice", info.price) }; return(ServiceDBHelper.ExcuteSql(SQL_UPDATE, param)); }
public int InsertGoods(GoodsInfo info, string nick) { SqlParameter[] param = new[] { new SqlParameter("@GoodsId", info.num_iid), new SqlParameter("@CId", info.cid), new SqlParameter("@GoodsName", info.title), new SqlParameter("@Pic_Url", string.IsNullOrEmpty(info.pic_url)?"": info.pic_url), new SqlParameter("@GoodsPrice", info.price), new SqlParameter("@NickNo", nick) }; return(ServiceDBHelper.ExcuteSql(SQL_INSERT, param)); }