Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Allowing to only add one instance in the table

Author  Topic 

shemayb
Posting Yak Master

159 Posts

Posted - 2008-04-02 : 12:45:55
The situation is like this,in my Requirements table,my fields are requirement_name,req_id and allow_multiple.allow_multiple.The fiels allow_multiple has a value of 0 and 1.In the Staff table,the fields are staff_id,staff_name,req_id.When we add requirement name to the staff table ot should check for the allow_multiple field, if it is 0 i can only add 1 instance of that requirement to the staff and if it is 1 i can add many instances of that requirement to the staff.How can i do that in c#?

Funnyfrog

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-04-02 : 13:21:24
well that's really based on how exactly is your DB logic handled.
if you have a dataset you can check the column value in the parent and if it's 0 and there's already a child don't let it insert anoter one...

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page
   

- Advertisement -