ppamorim

Untitled

Oct 23rd, 2013
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. private void btn_Procurar_Click(object sender, EventArgs e)
  2.         {
  3.             Informacao = tbx_Informacao.Text;
  4.  
  5.             //Segunda parte
  6.  
  7.             string connStr = "Driver={MySQL ODBC 5.2 ANSI Driver}; Server=localhost; Database=db_fingercontrol; User=root; Password=;Option=3";
  8.             OdbcConnection conn = new OdbcConnection(connStr);
  9.             OdbcCommand stringSQL_Login = conn.CreateCommand();
  10.             stringSQL_Login.CommandText = "SELECT Nome, RG, CPF,  FROM Cliente WHERE " + TipoInfo + " = " + Informacao;
  11.  
  12.             try
  13.             {
  14.                 conn.Open();
  15.                 OdbcDataReader reader = stringSQL_Login.ExecuteReader();
  16.                 while (reader.Read())
  17.                 {
  18.                     tbx_Nome.Text = reader["Nome"].ToString();
  19.                     tbx_RG.Text = reader["RG"].ToString();
  20.                     tbx_CPF.Text = reader["CPF"].ToString();
  21.                     tbx_Telefone.Text = reader[""].ToString();'
  22.                }
  23.            }
  24.            catch
  25.            {
  26.                MessageBox.Show("Ocorreu um erro na execução do SQL");
  27.                conn.Close();
  28.            }
  29.        }
Advertisement
Add Comment
Please, Sign In to add comment