Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using MySql.Data.MySqlClient;
- public partial class alteraCliente : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- string id = Request.QueryString["id"];
- string conexao = "Server=localhost;Database=Stonehenge;Uid=root;Pwd='';Connect Timeout=30;";
- MySqlConnection conn= new MySqlConnection(conexao);
- string comando = "select * from cliente where id=" + id;
- MySqlCommand cmd = new MySqlCommand(comando);
- cmd.Connection = conn;
- conn.Open();
- MySqlDataReader myLeitura = cmd.ExecuteReader();
- myLeitura.Read();
- Label1.Text = myLeitura["id"].ToString();
- nome.Text = myLeitura["nome"].ToString();
- endereco.Text = myLeitura["endereco"].ToString();
- Telefone.Text = myLeitura["telefone"].ToString();
- bairro.Text = myLeitura["bairro"].ToString();
- Cidade.Text = myLeitura["cidade"].ToString();
- estado.SelectedValue = myLeitura["estado"].ToString();
- cpf.Text = myLeitura["cpf"].ToString();
- myLeitura.Close();
- comando = "select * from assuntos where cpf=\"" + cpf.Text+"\"";
- cmd.CommandText = comando;
- MySqlDataReader ass = cmd.ExecuteReader();
- for (int i = 0; i <assuntos.Items.Count; i++) {
- ass.Read();
- if (assuntos.Items[i].Text == ass["assunto"].ToString()) {
- assuntos.Items.RemoveAt(i);
- prediletos.Items.Add(ass["assunto"].ToString());
- }
- }
- }
- protected void LtoR_click(object sender, EventArgs e)
- {
- for (int i = 0; i < assuntos.Items.Count; i++)
- {
- if (assuntos.Items[i].Selected)
- {
- prediletos.Items.Add(assuntos.SelectedItem);
- assuntos.Items.RemoveAt(assuntos.SelectedIndex);
- }
- }
- }
- protected void RtoL_Click(Object sender, EventArgs e)
- {
- for (int i = 0; i < prediletos.Items.Count; i++)
- {
- if (prediletos.Items[i].Selected)
- {
- assuntos.Items.Add(prediletos.SelectedItem);
- prediletos.Items.RemoveAt(prediletos.SelectedIndex);
- }
- }
- }
- protected void tudoL_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < prediletos.Items.Count; i++)
- {
- assuntos.Items.Add(prediletos.Items[i].Text);
- }
- prediletos.Items.Clear();
- }
- protected void tudoR_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < assuntos.Items.Count; i++)
- {
- prediletos.Items.Add(assuntos.Items[i].Text);
- }
- assuntos.Items.Clear();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement