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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sachin SinghPosted Jul 27, 2021, 10:10 AM
Valerie MeunierPosted Jul 29, 2021, 10:09 AM
Valerie MeunierPosted Jul 27, 2021, 10:04 AM
Sachin SinghPosted Jul 25, 2021, 6:39 PM
Rijwan AnsariPosted Jul 25, 2021, 5:06 PM
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 MeunierPosted Jul 25, 2021, 3:06 PM
Sachin SinghPosted Jul 24, 2021, 10:46 AM
Valerie MeunierPosted Jul 24, 2021, 9:55 AM
Sachin SinghPosted Jul 23, 2021, 7:19 PM
Jefferson S. MottaPosted Jul 23, 2021, 6:25 PM