protected void gridSupps_DeleteCommand(object source, DataGridCommandEventArgs e) { int SupID = Convert.ToInt32(e.Item.Cells[0].Text); DatabaseDB db = new DatabaseDB(); try { db.connectDb(); SqlCommand cmdDeleteSupplier = new SqlCommand("DeleteSuppliers", db.conn); cmdDeleteSupplier.CommandType = CommandType.StoredProcedure; cmdDeleteSupplier.Parameters.AddWithValue("@UserId", SupID); cmdDeleteSupplier.Parameters.Add("@Result", SqlDbType.Int); cmdDeleteSupplier.Parameters["@Result"].Direction = ParameterDirection.Output; cmdDeleteSupplier.ExecuteNonQuery(); if ((int)cmdDeleteSupplier.Parameters["@Result"].Value != 1) { utils.messagebox(lblmsg, "Kayıt silinemedi."); } } catch (SqlException sqlEx) { lblmsg.Text = sqlEx.Source + " >> " + sqlEx.Message; //throw sqlEx; } catch(Exception ex) { lblmsg.Text = ex.Source + " >> " + ex.Message; } finally { db.disconnectDb(); } FillSuppliersList(); }