 |
| ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application . |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 21st, 2004, 11:27 AM
|
|
Authorized User
|
|
Join Date: Sep 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
contraints and relationships
dear expert
i am using MS SQL2000 as my database, i design my database and its particular tables by using the SQL Enterprise manager.
then i set up each attirbute by declaring its data type, not null.....
ok, now the problem is i do this database design in advanced ways before the real coding step into. so, if i already establish
their relationship and constraints, what should i do in the coding side? is it need to do it in promgrammatic way to specify
the PK and FK constraint (refrential integrity) one by one or everything is being settle by establishing their relationship on
the database diagram?
futhermore, there's something call SQL script, what's the main deffirent between triggers, stored procedure when in what kind
of situation should calling the apporpriate events between SQL scrip[t, triggers and stored proceudre?
|
|

September 21st, 2004, 11:49 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey,
You can reestablish the constraint by creating a DataRelation. You can find this in the MSDN and on the web.
Triggers execute when data is inserted, updated, and deleted only. They can do whatever you want, but only on these events. Stored procedures you have to call (in your code). You can't call triggers in your code; they are only available on the database side.
Brian
|
|

September 22nd, 2004, 09:59 AM
|
|
Authorized User
|
|
Join Date: Sep 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
well, i just review it at MSDN and gain some understanding on DB structure.
I would like to use Treeview (namespace microsoft.web.UI.webcontrols)
as my interface. let say there are treenode A,B and C. If i check on treenode A, then this will perform an action on the related table
resides on the MSSQL 2000 (let say the table name is Alpha, and its field's (Treenode A,B,C)attribute is boolean type (check for true;uncheck for false, default is set to false).
i know it is something dealing with DML side. how do i doing this by using "Update...Set..." this query statemnt? how to define thier relation......and what should i do if i checked on particular check box for the treenode??
for this treeview is actually using by the admin site for granting the privilege to the user purpose.
thank you for reply on previous question.
|
|

September 22nd, 2004, 10:44 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hey,
You can create a relationship sure, for update statement, say you got t1, t2, t3, t3 contains a fk to t2, t2 contains a fk to t1.
Use three updates to update t1, t2, then t3. Depending on what you want triggers for, you may be able to do that too.
What do you want to do with the treeview, to then update the field? Most likely, if you are at the second-node level (data in t2), whatever changes you make don't typically involve the primary key, and won't be affected by t1 or t3. If there is a PK change, then you could use cascading which automatically changes the values in the FK tables.
Not sure what you mean about the checkbox thing?
Brian
Brian
|
|

September 24th, 2004, 07:05 AM
|
|
Authorized User
|
|
Join Date: Sep 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
dear brian
one very important thing to ask, there's no boolean datatpye in MS sql server 2000. what should i do with if i checked on the checkbox, it will change the column value from false ino true.
any web page or KB regrading this topic? should be something related with forrm+treeview+class checkboxex
thank you
|
|

September 24th, 2004, 08:50 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
For some reason they changed bool to bit...
Hal Levy
Web Developer, PDI Inc.
NOT a Wiley/Wrox Employee
|
|

September 24th, 2004, 10:43 AM
|
|
Authorized User
|
|
Join Date: Sep 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
yeah...but how to set the column data type with bit? what's the default value for it?
|
|

September 24th, 2004, 11:05 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Uh.. Bit is always either 1 or 0.. I believe you can use true/false also.
Hal Levy
I am here to help you, not do it for you.
|
|

September 24th, 2004, 11:20 AM
|
|
Authorized User
|
|
Join Date: Sep 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
so, set the default value=0 as false, after check it the value will be +1; then become true...
but this condition where should i put, is it stored procedure, triggers or inside the query builder pane?
|
|

September 24th, 2004, 11:23 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
sorry- I don't understand the question.
Hal Levy
I am here to help you, not do it for you.
|
|
 |