logo
down
shadow

DBgrid column very wide


DBgrid column very wide

Content Index :

DBgrid column very wide
Tag : sql , By : Jay Crockett
Date : November 21 2020, 03:00 PM

Hope that helps We have the following case. We need to change a field in a SQL Server database from varchar to nvarchar. After the change, all the dbgrid shows the very wide column. How can we globally adjust the size of this column? , Let's create a sample table:
CREATE TABLE PATIENT(
ID INT IDENTITY(1,1) PRIMARY KEY NOT NULL,
LastName NVARCHAR(50) NOT NULL
)
GO
INSERT INTO PATIENT VALUES
('Patient1'),
('Patient2'),
('Patient3');
DBGrid1.Columns[1].Width := Value;

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

DBGrid - how to show the differnce between a column value in two adjacent rows as another column?


Tag : mysql , By : user171555
Date : March 29 2020, 07:55 AM
help you fix your problem Let's say I record my car's latitude & longitude every minute or so, adding a row to a table each time. , You can do it either way:

How to use GridBagLayout to make a JLabel 1 column wide and then a JTextField 2 columns wide (for a total width 3 column


Tag : java , By : nagre
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , Using GridBagLayout columnWidths you can manually adjust the widths and then set the GridBagConstraints fill to GridBagConstraints.HORIZONTAL :
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout;
import javax.swing.JLabel;
import java.awt.GridBagConstraints;
import javax.swing.JTextField;
import java.awt.Insets;


public class Example extends JFrame {
    private static final long serialVersionUID = 1L;
    private JPanel contentPane;
    private JTextField textField;
    private JTextField textField_1;

    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    Example frame = new Example();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    public Example() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 450, 300);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        GridBagLayout gbl_contentPane = new GridBagLayout();
        gbl_contentPane.columnWidths = new int[] {100, 0};
        gbl_contentPane.rowHeights = new int[]{0, 0, 0};
        gbl_contentPane.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
        gbl_contentPane.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
        contentPane.setLayout(gbl_contentPane);

        JLabel lblNewLabel = new JLabel("jlabel");
        GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
        gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
        gbc_lblNewLabel.anchor = GridBagConstraints.WEST;
        gbc_lblNewLabel.gridx = 0;
        gbc_lblNewLabel.gridy = 0;
        contentPane.add(lblNewLabel, gbc_lblNewLabel);

        textField = new JTextField();
        GridBagConstraints gbc_textField = new GridBagConstraints();
        gbc_textField.insets = new Insets(0, 0, 5, 0);
        gbc_textField.fill = GridBagConstraints.HORIZONTAL;
        gbc_textField.gridx = 1;
        gbc_textField.gridy = 0;
        contentPane.add(textField, gbc_textField);
        textField.setColumns(10);

        JLabel lblNewLabel_1 = new JLabel("jlabel2");
        GridBagConstraints gbc_lblNewLabel_1 = new GridBagConstraints();
        gbc_lblNewLabel_1.anchor = GridBagConstraints.WEST;
        gbc_lblNewLabel_1.insets = new Insets(0, 0, 0, 5);
        gbc_lblNewLabel_1.gridx = 0;
        gbc_lblNewLabel_1.gridy = 1;
        contentPane.add(lblNewLabel_1, gbc_lblNewLabel_1);

        textField_1 = new JTextField();
        GridBagConstraints gbc_textField_1 = new GridBagConstraints();
        gbc_textField_1.fill = GridBagConstraints.HORIZONTAL;
        gbc_textField_1.gridx = 1;
        gbc_textField_1.gridy = 1;
        contentPane.add(textField_1, gbc_textField_1);
        textField_1.setColumns(10);
    }

}
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.miginfocom.swing.MigLayout;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class MigLayoutExample extends JFrame {
    private static final long serialVersionUID = 1L;
    private JPanel contentPane;
    private JTextField textField;
    private JTextField textField_1;

    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    MigLayoutExample frame = new MigLayoutExample();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    public MigLayoutExample() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 450, 300);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        contentPane.setLayout(new MigLayout("", "[grow 33][grow 66]", "[][]"));

        JLabel lblNewLabel = new JLabel("New label");
        contentPane.add(lblNewLabel, "cell 0 0");

        textField = new JTextField();
        contentPane.add(textField, "cell 1 0,growx");
        textField.setColumns(10);

        JLabel lblNewLabel_1 = new JLabel("New label");
        contentPane.add(lblNewLabel_1, "cell 0 1");

        textField_1 = new JTextField();
        contentPane.add(textField_1, "cell 1 1,growx");
        textField_1.setColumns(10);
    }

}

Delphi select line in a dbgrid and show other lines in other dbgrid


Tag : delphi , By : Harry Truman
Date : March 29 2020, 07:55 AM
I hope this helps you . Use a separate query for your customer table, with SQL something like this (replace CustQuery with the name of your own ADOQuery component, and the table and column names for your actual table information, of course):
CustQuery.SQL.Text := 'SELECT c.customer_name, c.customer_address' + #13 +
                      'FROM customer c' + #13 +
                      'WHERE c.provider_name = :provider';
procedure TForm1.ProviderQueryAfterScroll(DataSet: TDataSet);
begin
  CustQuery.DisableControls;
  try
    CustQuery.Close;
    CustQuery.Paramseters.ParamByName('provider').Value :=
      ProviderQuery.FieldByname('Provider_Name').Value;
    CustQuery.Open;
  finally
    CustQuery.EnableControls;
  end;
  CustQuery.Open;
end;

Have the 8-column-wide div all the 12 columns if the 4-column-wide div is not exist with Twitter Bootstrap


Tag : php , By : PsyberMonkey
Date : March 29 2020, 07:55 AM
Hope this helps What I want is, if the the 4-column-wide section is not exist, means it's disabled server-side, the 8-column-wide section will have all the 12 columns. , The solution that's coming from my mind:
$var = true; // sometimes false
<div class="row">
  <?php if ($var) echo '<div class="col-md-4">.col-md-4</div>'; ?>
  <div class="col-md-<?php
    if ($var) :
      echo 8;
    else :
      echo 12;
    endif;
  ?>">.col-md-8</div>
</div>

Adding a search that searches data in a DBGrid and temporarily changes what that DBGrid displays- Delphi


Tag : mysql , By : pacorro2000
Date : March 29 2020, 07:55 AM
This might help you If you're dealing with a small number of rows returned by your SQL SELECT, you can use TDataSet.Filter and TDataSet.Filtered. You can get the input from anywhere you'd like, such as a plain old TEdit.
As you've posted no details (such as the DB controls you're using, the version of Delphi, any code that gives variable names, or anything else), here's a very generic sample that may help. I'm calling the query attached to the DBGrid Qry, because have no idea what else to call it based on what you've posted. FilterRecordsButton and ClearFilterButton are TButtons, and SearchEdit is a TEdit. Feel free to use any control you want to toggle the filter or get the input from the user.
procedure TForm1.FilterRecordsButtonClick(Sender: TObject);
begin
  if SearchEdit.Text <> '' then
  begin
    {
     The brackets around the column name are required because you've got 
     spaces in the name; they're also needed if your column name is a 
     reserved word. QuotedStr puts the necessary quote characters around
     the value.
    }
    Qry.Filter := '[Customer Name] = ' + QuotedStr(SearchEdit.Text);
    Qry.Filtered := True;
    Qry.First;
    FilterRecordsButton.Enabled := False;
    ClearFilterButton.Enabled := True;
  end;
end;

procedure TForm1.ClearFilterButtonClick(Sender: TObject);
begin
  Qry.Filtered := False;
  Qry.Filter := '';
  Qry.First;
  ClearFilterButton.Enabled := False;
  FilterRecordsButton.Enabled := True;
end;
Related Posts Related QUESTIONS :
  • how to use rank/join and where together
  • How to create new column with values counting up every 9th value with SQL?
  • Most frequent combination of words/characters SQL Server
  • Why can't I access a field defined as "Select 1" from a subquery in the outer query?
  • How to solve Msg 8115, Level 16, State 2, Line 2 Arithmetic overflow error converting expression to data type int.?
  • UPDATE row inserted earlier in CTE
  • Display current month values based upon abbreviation (Oct) SQL Server
  • SQL Modify returned select value without union
  • How to put a variable in a like statement in vba?
  • More Elegant way to Batch Validate Phone Numbers
  • SQL find parent where children match over multiple rows
  • A combo box that has to be filter the same data in that field
  • Exclude updated record from trigger function
  • Insert into table from select only when select returns valid rows
  • How to fix SQLite3::SQLException: near "to": syntax error: SELECT "".* FROM "" WHERE "
  • Filter msdb.dbo.sysjobsteps.command into seperate columns
  • How to extract year or month,day from oracle function without using sub-query?
  • Reset sum when condition is met in Oracle
  • Date Between (Start & Now)
  • Reset running sum when condition is met in Oracle
  • Why is my date criteria filtering incorrectly in a MsysObjects query using DCount?
  • Stripping date/time delimiters in an SSIS csv export
  • SSIS Error on insertion - Error when new primary keys in Dimension table
  • How can I make a temp table of specific datetime data within a range?
  • AnalysisException: Syntax error in SQL After multiple join
  • SQL Query Multiple Columns Using Distinct on One Column Only and Using Order By
  • Sum inventory item groups
  • TSQL: Parsing strings with various characters
  • Using SQL Server : how to use select criteria based on sum
  • Inserting dynamic pivot Result into Temp table
  • Joining multiple fields in a dataset joined with descriptions
  • Conditional WHERE EXISTS in Oracle query
  • How to get the count of each unique value in a column between two dates?
  • SQL: Select only if multiple values are IN 1 column from CatalogTable
  • In a query (no editing of tables) how do I join data without any similarities?
  • Create nested json blobs in PostgreSQL
  • Getting extra dates while using cte
  • Way to alter one table if another was altered
  • Proper use of semicolons in functions and procedures
  • Cursor Not looping all the Records
  • Select inner join returns wrong result
  • Group By showing duplicates
  • Error in using subquery in access join query
  • How do I use a composite pk in a stored procedure?
  • Oracle Unique Indexes
  • Spooling data to CSV truncates
  • How do views reduce code duplication?
  • SQL: Gather right hand values from a join
  • SQL Agent Logon - What is going on?
  • How do I combine two rows of same part, but add quantities?
  • How to optimize this SQL query for a rectangular region?
  • Pass data from ssrs subreport to parent
  • how to enter values in rowguid column?
  • Read multiple tables from dataset in Powershell
  • In SQL how to I exclude a record if there are more than 3 characters after a dash
  • What is the difference between check and foreign key?
  • How to return a record from function, executed by INSERT/UPDATE rule (trigger)?
  • SQL order by oldest from Unix Timestamps
  • How to convert decode function in oracle to standard big query
  • Postgresql: An alternative to subqueries to make the query more efficient?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com