如何在数据库中存储单个标题的行数? [英] How to store no.of rows where having single heading in database?

查看:94
本文介绍了如何在数据库中存储单个标题的行数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个场景,



i在asp中设计了一个页面。 net,slot.aspx



其中我有一个SlotName文本框,在一个表中我有没有插槽,即。,

 <   table  > ;  
< tr > < tdcolspan = 3 > 广告位名称 < / td > < / tr >
< tr >
< td > < 输入 type = text id = startime / < span class =code-keyword>> < / td >
< td > < 输入 type = 时间 id = endime / > < / td >
< td > < 输入 类型 = 按钮 id =' remove'< /跨度> < span class =code-attribute> value =' 删除' / > ; < / td >
< / tr > ;
< tr >
< td > < 输入 type = time <跨度cl ass =code-attribute> id = startime / > < / td >
< td > < ; 输入 type < span class =code-keyword> = time id = endime / > < / TD >
< td > < 输入 type = button id =' 删除' value =' 删除' / > < / td >
< / tr >
< tr >
< td > < input type = time id < span class =code-keyword> =
startime / > < / td >
< td > < input 类型 = time id = endime / > < / td >
< td > < 输入 type = 按钮 id =' remove' =' 删除' / > < / td >
< / tr >
< tr >
< td > < 输入 类型 = 时间 id = startime / > < / td >
< td > < < span class =code-leadattribute> input type = 时间 id = endime / <跨度class =code-keyword>> < / td >
< td > < input type = 按钮 id =' remove' value =' remove' / > < / td >
< / tr >
< / table >





我尝试了什么:



我想在sql表中存储这些数据。 

我应该为每一行存储相同的名称或如何。



可以任何一个plz帮助我,表的结构应该是什么这个。





谢谢

解决方案

为了照顾可能有一个IDENTITY列的插槽名称(可能还有其他)的重复值。如何实现它是一个特定于数据库的,但它会自动 为表中的每一行分配一个唯一值。然后,您可以使用where子句中的标识号对该特定记录进行操作。您可能希望在表上设置约束,例如禁止两个项目具有相同的插槽,开始和结束,或者您希望禁止的任何其他内容,以便在数据库中输入它将失败。



创建表格时可以做很多事情,使您的工作不仅更容易,而且不会让您的数据不太可能被意外毁坏。

Hi guys,

I have one scenario,

i have designed one page in asp.net, slot.aspx

where i have one textbox for SlotName and in one table i have no.of slots, ie.,

<table>
<tr><tdcolspan="3">Slot Name</td></tr>
<tr>
<td><input type="text" id="startime"/></td>
<td><input type="time" id="endime"/></td>
<td><input type="button" id='remove' value='remove' /> </td>
</tr>
<tr>
<td><input type="time" id="startime"/></td>
<td><input type="time" id="endime"/></td>
<td><input type="button" id='remove' value='remove' /> </td>
</tr>
<tr>
<td><input type="time" id="startime"/></td>
<td><input type="time" id="endime"/></td>
<td><input type="button" id='remove' value='remove' /> </td>
</tr>
<tr>
<td><input type="time" id="startime"/></td>
<td><input type="time" id="endime"/></td>
<td><input type="button" id='remove' value='remove' /> </td>
</tr>
</table>



What I have tried:

I want to store this data, in the sql table.

should i stored same name for each row or how.


can any one plz help me, what should be the structure of the table for this.


Thanks

解决方案

In order to take care of possible duplicate values of the slot name (and possibly the others) you should have an IDENTITY column. How this is implemented is a bit database specific, but it will assign, automatically, a unique value to each row in your table. You can then operate on that specific record by using the identity number in your where clause. You may wish to put constraints on your table, as well, such as forbidding two items from having the same slot, start, and end, or whatever else you wish to forbid so that entering it in the database will fail.

There's a lot of stuff you can do when creating your table to make your work not only much easier and keep your data less likely to be ruined by accident.


这篇关于如何在数据库中存储单个标题的行数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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