public bool existeDocumento(int doc) { bool bandera = false; SqlDataReader dr; cmd = new SqlCommand("SP_EXISTE_DNI_AFILIADO", Conectar.ObtenerConexion()); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@NRODOC", SqlDbType.Int).Value = doc; dr = cmd.ExecuteReader(); Conectar.CerrarConexion(); if (dr.Read()) { bandera = true; } return(bandera); }
public void cargarDataGrid(DataGridView miDataGrid, string consulta) { DataSet miDataSet = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(consulta, Conectar.ObtenerConexion()); da.Fill(miDataSet); Conectar.CerrarConexion(); miDataGrid.RowHeadersVisible = false; miDataGrid.AllowUserToAddRows = false; miDataGrid.AllowUserToDeleteRows = false; miDataGrid.AllowUserToOrderColumns = false; miDataGrid.AllowUserToResizeColumns = true; miDataGrid.AllowUserToResizeRows = false; miDataGrid.AutoResizeColumns(); miDataGrid.DataSource = miDataSet.Tables[0]; //estas dos lineas siguientes indican q las celdas se ajusten al contenido //----------------------------------------------------------------------- miDataGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; miDataGrid.BorderStyle = BorderStyle.None; //--------------------------------------------------------------------- }