ZKX's LAB

Delphi 获取字段名称 delphi中ADOQoery如何获取数据库某个字段的所有数据?

2020-07-27知识13

delphi DBGrid 如何获取当前选中行的某个字段的值 是dbgrid就应该是和数据库的表有关联,也就是用了query或table做了查询,当然显示可以依靠query或table来实现。比如在query的afterscroll事件里写赋值代码,edit1.text:=fieldbyname('id').asstring;用delphi获得数据库中字段值 with adoquery1 dobeginclose;sql.clear;sql.text:='select name from 表名';open;end;adoquery1.first;while not adoquery1.eof dobeginmemo1.lines.add(adoquery1.fieldbyname('name').asstring);adoquery1.next;end;Delphi怎么读取Excel表的所有字段名并读入到ComboBox tryFilePath:='G:\\新建.xls';Excel:=CreateOLEObject('Excel.Application');WorkBook:=Excel.WorkBooks.Open(FilePath);WorkSheet:=WorkBook.WorkSheets.Item[1];打开sheet1for I:=1 to WorkSheet.UsedRange.Columns.Count do/循环列beginShowMessage(WorkSheet.Cells[1,I]);取第一行所有列的值end;finallyWorkBook.Close;Excel:=Null;end;引用ComObj单元

#delphi#sql修改字段长度#数据库

随机阅读

qrcode
访问手机版