zoukankan      html  css  js  c++  java
  • 传入sql语句,执行完提取内容赋值到控件上

    class procedure DBTools.FillStrings(ComboBoxEh: TDBComboBoxEh; sql: string; Default: Boolean = False);
    var
    Q2: TADOQuery;
    begin
    ComboBoxEh.KeyItems.Clear;
    ComboBoxEh.Items.Clear;
    Q2 := ExecuteSelect(sql);
    if Q2.FieldCount = 1 then
    begin
    if Default then
    ComboBoxEh.Items.Append('全部');
    while not Q2.Eof do
    begin
    ComboBoxEh.Items.Append(Q2.Fields[0].AsString);
    Q2.Next;
    end;
    end;
    if Q2.FieldCount >= 2 then
    begin
    if Default then
    begin
    ComboBoxEh.KeyItems.Append(' ');
    ComboBoxEh.Items.Append('全部');
    end;
    while not Q2.Eof do
    begin
    ComboBoxEh.KeyItems.Append(Q2.Fields[0].AsString);
    ComboBoxEh.Items.Append(Q2.Fields[1].AsString);
    Q2.Next;
    end;
    end;
    Q2.Close;
    Q2.Free;
    if ComboBoxEh.DataSource = nil then
    ComboBoxEh.ItemIndex := 0;
    end;

    class procedure DBTools.FillStrings(ColumnEh: TColumnEh; sql: string; Default: Boolean = False);
    var
    Q2: TADOQuery;
    begin
    ColumnEh.KeyList.Clear;
    ColumnEh.PickList.Clear;
    Q2 := ExecuteSelect(sql);
    if Q2.FieldCount = 1 then
    begin
    if Default then
    ColumnEh.PickList.Append('全部');
    while not Q2.Eof do
    begin
    ColumnEh.PickList.Append(Q2.Fields[0].AsString);
    Q2.Next;
    end;
    end;
    if Q2.FieldCount >= 2 then
    begin
    if Default then
    begin
    ColumnEh.KeyList.Append(' ');
    ColumnEh.PickList.Append('全部');
    end;
    while not Q2.Eof do
    begin
    ColumnEh.KeyList.Append(Q2.Fields[0].AsString);
    ColumnEh.PickList.Append(Q2.Fields[1].AsString);
    Q2.Next;
    end;
    end;
    Q2.Close;
    Q2.Free;
    end;

  • 相关阅读:
    EOJ2032 判断两个数是否相等
    EOJ2529 强大的lwc
    EOJ 1199 Anagram
    EOJ2530 数字之和
    EOJ2941 在线投票系统
    EOJ2124 Seamild的电梯
    EOJ 1027 邮资的问题
    通过js导入js,通过js导入css
    无意间在我系统中发现的一张图~~~~~
    css系列看过之后让我~~~
  • 原文地址:https://www.cnblogs.com/zyb2016/p/6077495.html
Copyright © 2011-2022 走看看