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.
| Author |
Topic |
|
imranabdulaziz
Yak Posting Veteran
83 Posts |
Posted - 2007-06-25 : 02:03:51
|
| Dear all, i am using sql 2005 , asp.net and C#.i have made reference to two table that is master and transaction.sp that no data in transaction will be saved if its not exist in master. Now when i goes to delete the record which is there in transaction. i get refercial table error message. i would like to know how can i make sure that if data exist in transaction table. instead of sql error i pop up some error. please guide me.thank you |
|
|
pbguy
Constraint Violating Yak Guru
319 Posts |
Posted - 2007-06-25 : 02:58:41
|
| What is the relation between the master and transaction...--------------------------------------------------S.Ahamed |
 |
|
|
imranabdulaziz
Yak Posting Veteran
83 Posts |
Posted - 2007-06-25 : 03:29:46
|
| master is where product details saves.and transaction is where product activity saves and both are link with productid. say product is TV then its master saves tvcode , size , color , company etc. and its transaction saves tvcode, dateof sales , qty of sale , customer etc.hope it is clear know.thanks |
 |
|
|
pbguy
Constraint Violating Yak Guru
319 Posts |
Posted - 2007-06-25 : 03:47:50
|
| Transaction table references the product id in the master table. if so while deleting a record from the transaction table should not give any error and reverse will give u error.for insertion...IF Exists(Select product_id from master where condition)Insert Into transaction ....--------------------------------------------------S.Ahamed |
 |
|
|
imranabdulaziz
Yak Posting Veteran
83 Posts |
Posted - 2007-06-25 : 04:28:40
|
| what i am tring to tell is that while if there is some record in transaction then while deleting that product we do get reference table ka error . i want to know how i trace that error and show in front end. this very specific example. now for any error my question is Is there any way where i display record applopiate message against the generated error. please helpthank for yours quick responsivenessthnks |
 |
|
|
pbguy
Constraint Violating Yak Guru
319 Posts |
Posted - 2007-06-25 : 04:44:41
|
| Ohh..I am sorry, I donno asp.net, but i think the transaction object you use to connect database will have some attribute which give u the last statement is executed correctly or not.--------------------------------------------------S.Ahamed |
 |
|
|
|
|
|