Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <tr>
- <td >
- Escolha um perfil
- </td>
- <td>
- <asp:DropDownList ID="mostraUsuarios" runat="server" >
- </asp:DropDownList>
- <asp:Button runat="server" Text="Carregar perfil" OnClick="carregaPerfilUsuario"/>
- </td>
- </tr>
- protected void carregaPerfilUsuario(object sender, EventArgs e)
- {
- String nome = mostraUsuarios.SelectedItem.Value; // pega valor do dropDownList
- SqlConnection conn = new SqlConnection("Data Source=sqlserver01.webint.com.br;Initial Catalog=webint;Persist Security Info=True;User ID=webint;Password=igor1990");
- SqlDataReader reader = null;
- SqlCommand cmm = new SqlCommand("select * from tb_usuarios where nome = '" +nome+"'", conn);
- try
- {
- conn.Open();
- reader = cmm.ExecuteReader();
- editar_nome.Text = reader.GetString(2);
- editar_email.Text = reader.GetString(3);
- editar_telefone.Text = reader.GetString(5);
- }
- catch (Exception ex)
- {
- // throw ex;
- }
- finally
- {
- conn.Close();
- conn.Dispose();
- }
- }
Add Comment
Please, Sign In to add comment