插入到数据库字段中的逗号分隔值 [英] insert into a database field comma separated values

查看:135
本文介绍了插入到数据库字段中的逗号分隔值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友

如何在数据库中的一个字段中单独插入昏迷中的爱好,就像我有三个hobyy玩烹饪和阅读,我有插入喜欢的爱好,烹饪,阅读所以如何可能

谢谢

hi friends
how to insert hobby in coma separate in one field in database like i have three hobyy playing cooking and reading and i have insert like hobby,cooking,reading so how to it possible
thanks

推荐答案

我看起来并不是一个好主意(它与数据库规范化原则相反)。

无论如何,这并不困难:只需调用 String。替换 [ ^ ]方法可以解决这个问题。
I doesn't look a good idea (it goes in the opposite direction of database normalization principles).
In any case, it is not difficult: just a call to the String.Replace[^] method could do the trick.


不应该将逗号限制项插入到表中。

将这些项拆分为您要存储的值另一个表,并在需要结果时连接这两个表。
Comma limited items should not be inserted into a table.
Split these items up into values that you would store in another table and join these two tables whenever you want results.


这篇关于插入到数据库字段中的逗号分隔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆