with datamodule1.qdepartment do
begin
close;
sql.clear;
sql.add('select * from department order by departmentid');
open;
end;
while not datamodule1.qdepartment.eof do
begin
combobox4.items.Add(datamodule1.qdepartment.fieldbyname('departmentname').Value);
datamodule1.qdepartment.Next; //数据后移
end;
我通过如上代码将department表中的部门名循环添加到combobox4中..在一个信息录入窗口中,我通过选取combobox中的部门名,怎么将该部门名岁对应的部门号插入到一个表(该表含有部门号字段,即部门号字段为该表的外键)中呢?...//不要再告诉我又循环娶出来做比较然后再确定部门号啊,那太晕了哈..department table: (departmentid,departmentname,re)
解决方案 »
- usb插拔有消息产生?有办法接收到这个消息处理吗?
- Delphi 6.0 和 C++ Builder 6.0 为什么无法安装到同一个系统下面?
- 我做的一个类似于SPY++的工具软件。大家看看哈,但愿对大家有用,参与有分。
- 怎么安装只有*.dcu的组件?
- 生成Form时遇到的问题。
- !!!任务栏右键菜单(添加自己的菜单)!
- 100分 請教:Delphi7+Oracle10,ADO連接,C/S架構,如何獲取用戶連接數據庫session?多謝!
- 打印时碰到的一个问题!高手请进!!
- 想学习TTS,哪有文档/教材/源码等
- 那里有(下载)InterBase5.6
- 请高手帮我看看问题出在哪里?
- DELPHI2007简单试用手记,老BUG依然存在
用AddObject添加Integer(combobox4.Items.Objects[combobox4.ItemIndex]
这个是得到编号
begin
close;
sql.clear;
sql.add('select * from department order by departmentid');
open;
end;
while not datamodule1.qdepartment.eof do
begin
combobox4.items.Add(datamodule1.qdepartment.fieldbyname('departmentname').Value,datamodule1.qdepartment.fieldbyname( 'departmentname ').Value);
datamodule1.qdepartment.Next; //数据后移
end;
读取时,使用:
如是整型integer(combobox4.items.Objects[Combobox4.ItemIndex])
其余类型类似...