Think the best of others
Thursday, October 23, 2008
Catch Exception en asp:SqlDatasource before insert
Catch Exception en asp:SqlDatasource before insert
1. Clientes.aspx
< asp:SqlDatasource
...
OnInserting="SqlDataSourceClientes_Inserting" >
2. Clientes.aspx.cs
protected void SqlDataSourceClientes_Inserting(object sender, SqlDataSourceCommandEventArgs e)
{
try
{
e.Cancel = true;
e.Command.ExecuteNonQuery();
LabelMensaje.Text = "Cliente Ingresado Correctamente";
}
catch
{
LabelMensaje.Text = "Cliente No Ingresado, verifique Nombre no repetido u otro parametro.";
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment