问题描述
您好
我正在为ASP.NET中的网站创建一个标记数据库。在我的系统中,用户可以提交他们的文章,这些文章可以有与之关联的标签。我搜索了互联网,发现toxi解决方案是一个很好的方式来满足我的需求。这个架构有3个表:
Table_Articles: id,name,description
Table_TagMap: id,article_id,tag_id
Table_Tag: tag_id,名称
我创建了数据库和表但是我在asp.net中创建插入命令时遇到了麻烦。我想我必须使用以下过程添加标签?
1.将提交的标签分类到数组
2.每个标签在数组中:
1.从标签中获取tag_id,其中name与当前标签匹配
2.如果返回0行:
1。将标签添加到标签表
2.获取tag_id
3.将article_id和tag_id添加到tagmap
3.完成(给用户a -okay等)
你能帮我写一下asp.net中的插入查询吗?
在此先感谢!
Hello
I'm creating a tag database for my website in ASP.NET. In my system users can submit their articles and those articles can have tags associated with them. I searched the internet and found the toxi solution a good way to suit my needs. This schema has 3 tables:
Table_Articles: id, name, description
Table_TagMap: id, article_id, tag_id
Table_Tag: tag_id, name
I created the database and tables but I'm having troubles creating the insert command in asp.net. I think I have to use the following process to add the tags?
1. sort submitted tags into array
2. for every tag in the array:
1. get tag_id from tags where name matches the current tag
2. if that returns 0 rows:
1. add tag to tags table
2. get the tag_id
3. add article_id and tag_id to tagmap
3. finish (give user the a-okay, etc)
could you help me write the insert query in asp.net?
Thanks in advance!
这篇关于使用Toxi模式插入标记数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!