Código
private void radButton1_Click(object sender, EventArgs e) { if(txtNro.Text=="") MessageBox.Show("DEBE INGRESAR UN NRO DE ORDEN", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); else if (txtNro.Text != "") { conexion.Open(); SqlCommand consulta = new SqlCommand("select Convert(varchar(10),fecIni,103) as fecIni ,Convert(Varchar(10),fecFin,103) as fecFin from ordenes where nro_orden=@nro", conexion); consulta.Parameters.AddWithValue("@nro", Convert.ToInt32(txtNro.Text)); SqlDataReader registro = consulta.ExecuteReader(); if (registro.Read()) { labelIni.Text = Convert.ToString(registro["fecIni"]); labelFinal.Text = Convert.ToString(registro["fecFin"]); } else { MessageBox.Show("NO SE ENCONTRO EL NUMERO DE ORDEN INGRESADO", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); labelIni.Text = ""; labelFinal.Text = ""; } conexion.Close(); conexion.Open(); SqlCommand consulta2 = new SqlCommand("select medicamento,cantidad,programa,precioUnit,precioFin from DetalleOrden where nro_orden=@nro",conexion); consulta2.Parameters.AddWithValue("@nro", Convert.ToInt32(txtNro.Text)); da.Fill(dt); rgv.DataSource = dt; conexion.Close(); } }