Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button1_Click(object sender, EventArgs e)
- {
- ConexionDB cnx = new ConexionDB();
- textBoxNombre.Text = cnx.Select("clientes",textBoxCodigo.Text);
- }
- public string Select(string strFrom, string strWhere)
- {
- string query = "SELECT nombre FROM "+strFrom+" WHERE numero ='"+strWhere+"' AND TIPO = 'C'";
- string result="";
- if(this.OpenConnection())
- {
- OdbcCommand cmd = new OdbcCommand(query,conexion);
- OdbcDataReader dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- result = dr["nombre"].ToString();
- }
- }
- this.CloseConnection();
- return result;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- ConexionDB cnx = new ConexionDB();
- textBoxNombre.Text = cnx.Select("nombre","clientes",textBoxCodigo.Text);
- }
- public string Select(string strSelect, string strFrom, string strWhere)
- {
- string query = "SELECT "+strSelect+ " FROM "+strFrom+" WHERE numero ='"+strWhere+"' AND TIPO = 'C'";
- string result="";
- if(this.OpenConnection())
- {
- OdbcCommand cmd = new OdbcCommand(query,conexion);
- OdbcDataReader dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- result = dr["strSelect"].ToString();
- }
- }
- this.CloseConnection();
- return result;
- }
- while (dr.Read())
- {
- result = dr["strSelect"].ToString();
- }
Add Comment
Please, Sign In to add comment