Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/05/2005, 03:33
Avatar de Nombela
Nombela
 
Fecha de Ingreso: abril-2005
Mensajes: 611
Antigüedad: 19 años, 1 mes
Puntos: 1
Con boton

La verdad es que ya engo echo una parte de la actualizacion xq no solo salen los servicios sino tambien los datos del usuario. Entonces lo tengo echo en el on_click del boton:

private void actualizarusu(object sender, System.EventArgs e)
{
myConnection = new SqlConnection (connectionString);
string updateCmd;

if (ConfUsPass.Visible)
{
updateCmd = "UPDATE Usuarios SET UsNombre=@UsNombre,UsPass=@UsPass,UsMail=@UsMail,U sTelefono=@UsTelefono,UsIdPer=@UsIdPer where UsId=@UsId";
}
else
{
updateCmd = "UPDATE Usuarios SET UsNombre=@UsNombre,UsMail=@UsMail,UsTelefono=@UsTe lefono,UsIdPer=@UsIdPer where UsId=@UsId";
}
myCommand = new SqlCommand(updateCmd, myConnection);
myCommand.Parameters.Add(new SqlParameter("@UsId",
SqlDbType.Int, 4));
myCommand.Parameters["@UsId"].Value = ComboLogin.SelectedItem.Value;
myCommand.Parameters.Add(new SqlParameter("@UsNombre",
SqlDbType.NVarChar, 50));
myCommand.Parameters["@UsNombre"].Value = UsNombre.Value;
myCommand.Parameters.Add(new SqlParameter("@UsPass",
SqlDbType.NVarChar, 50));
myCommand.Parameters["@UsPass"].Value = UsPass.Value;
myCommand.Parameters.Add(new SqlParameter("@UsMail",
SqlDbType.NVarChar, 50));
myCommand.Parameters["@UsMail"].Value = UsMail.Value;
myCommand.Parameters.Add(new SqlParameter("@UsTelefono",
SqlDbType.NVarChar, 15));
myCommand.Parameters["@UsTelefono"].Value = UsTelefono.Value;
myCommand.Parameters.Add(new SqlParameter("@UsIdPer",
SqlDbType.Int, 4));
myCommand.Parameters["@UsIdPer"].Value = UsPerfil.SelectedItem.Value;
myCommand.Connection.Open();
try
{
if ((ConfUsPass.Visible) && (UsPass.Value!=ConfUsPass.Value))
MsgBox1.alert("El password no es correcto");
else
{
int numreg=myCommand.ExecuteNonQuery();
//updateservicios();
Response.Redirect("MenuadministradorUsu.aspx?Oku=1 &Nombre="+Request.QueryString["Nombre"].ToString()+"&Id="+Request.QueryString["id"].ToString()+"&mod="+ComboLogin.SelectedItem.Value) ;
//Response.Redirect("Menuadministrador1.aspx?Oku=1&m od="+nombre.Text);
}
}
catch (SqlException c)
{
if (c.Number == 2627)
mensage.Text = "ERROR: Este cliente ya existe";
else
mensage.Text = "ERROR: No se ha podido añadir el registro, por favor " +
"asegurese de que todo esta correctamente escrito, gracias";

}
myCommand.Connection.Close();
}

Ahora habia creado una funcion updateservicios() para hacer eso pero no veo como