使用Toxi模式插入标记数据库 [英] insert into tag database using Toxi schema

查看:73
本文介绍了使用Toxi模式插入标记数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好



我正在为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中的插入查询吗?



在此先感谢!

解决方案

没有机构会为您编写整个代码。你必须这样做。

如果你遇到代码困难,那么我们可以提供帮助。但那就是你要编码的人。



你拥有所有的步骤和逻辑。这只是用SQL语言解释的问题。

你需要使用SQL和IF ELSE块等语句。所以,继续写一下来实现你的目标。



如果您不了解SQL,那么首先通过在Google或代码项目本身上搜索一些基本文章来学习。

您会发现很多示例。只需通过它们学习。



希望你理解。



继续编码。 :)

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!

解决方案

No body is going to write the whole code for you. You have to do that.
If you face difficulty in code, then we can help. But that is you who is going to code.

You have all the steps and logic with you. It is just a matter of interpreting in SQL language.
You need to use statements of SQL and IF ELSE block etc.. So, go on write to achieve your goal.

If you don't know SQL, then first learn by searching some basic articles on Google or on Code Project itself.
You will find many examples. Just go through them and learn.

Hope you understand.

Keep coding. :)


这篇关于使用Toxi模式插入标记数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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