Hi,
how to prevent error caused by a sql statement in sqldatsource in aspx file e.g. "Cannot insert duplicate key row in object 'dbo.table1'"? I would replcace that ugly message by my own message.
Thanks
V
Hi,
how to prevent error caused by a sql statement in sqldatsource in aspx file e.g. "Cannot insert duplicate key row in object 'dbo.table1'"? I would replcace that ugly message by my own message.
Thanks
V
Know the answer? Post it. Somebody with the same question will find it here.
Sachin SinghRank #66 · 26.2K reputationPosted Jul 27, 2021, 6:10 AM EDT
Valerie MeunierRank #1,527 · 1K reputationPosted Jul 25, 2021, 11:06 AM EDT
Rijwan AnsariRank #82 · 24.2K reputationPosted Jul 25, 2021, 1:06 PM EDT
I can add few more suggestions.
- Always validate the data before entring into SQL like duplicate check, data type validations, length and so on.
- You can capture exceptions/errors into log file. Create generic function for to handle that.
- Redirect to error page for unhandle error/exception with generic message like something went wrong.
Regards
Rijwan
Valerie MeunierRank #1,527 · 1K reputationPosted Jul 27, 2021, 6:04 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jul 23, 2021, 3:19 PM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jul 24, 2021, 6:46 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jul 25, 2021, 2:39 PM EDT
Valerie MeunierRank #1,527 · 1K reputationPosted Jul 29, 2021, 6:09 AM EDT
Jefferson S. MottaRank #207 · 11.7K reputationPosted Jul 23, 2021, 2:25 PM EDT
Valerie MeunierRank #1,527 · 1K reputationPosted Jul 24, 2021, 5:55 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts