一个关于ADO的问题 我是用的是ado,在不知道表的结构的情况下,我如何往表里添加一条记录,该记录主键的值为‘new’,其他的为空或者默认值,在线等待,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 query1.insert;Query1.FieldByName('主键名').asstring:='New'Query1.post; Query1.fieldList[0].asstring:='New'这里认为主键是第1字段 select * from yourtablename where 1=2这样取得表中的字段类型for i:=0 to ADOQuery1.Fields.Count-1 do ADOQuery1.Fields[i].DisplayName 你是否发现下面两句是一样的效果:INSERT INTO Users (User_Name, Password, Name)VALUES ('sdf1', 'ddd', NULL)/////////////////////////////////////INSERT INTO Users (User_Name, Password)VALUES ('sdf1', 'ddd')///////////////////////////////////// VAR in_PriKey:string; in_FieldNameList:TStringList; in_FieldNameList:=TStringList.Create(); ClothDataModule.m_Table.GetFieldNames(in_FieldNameList); in_PriKey:=in_FieldNameList.Strings[0]; ClothDataModule.m_Table.Last; ClothDataModule.m_Table.Insert; ClothDataModule.m_Table.FieldByName(in_PriKey).AsString:='new'; ClothDataModule.m_Table.Post; 散分挡X 获取代码长度问题 dbgrid的问题? 备份问题~~~~~~~~~~~~~~~~~ 窗体的固定(移动)问题? Delphi的多维数组 TMD下岗了,郁闷,散分,有招聘的于我联系!!! 请高手指点迷津 请教,看看下面的语句: 请问如何让一个Form Create 之后,ListBox1.SetFocous;然后再自动选中其中一个Item? faint问题:*.gdb是何文件,用什么可以打开? 我要做一个程序,其中一些功能只允许 Windows 2000 的系统管理员才能运行,该怎么做?
Query1.FieldByName('主键名').asstring:='New'
Query1.post;
这里认为主键是第1字段
这样取得表中的字段类型
for i:=0 to ADOQuery1.Fields.Count-1 do
ADOQuery1.Fields[i].DisplayName
INSERT INTO Users
(User_Name, Password, Name)
VALUES ('sdf1', 'ddd', NULL)
/////////////////////////////////////
INSERT INTO Users
(User_Name, Password)
VALUES ('sdf1', 'ddd')
/////////////////////////////////////
in_PriKey:string;
in_FieldNameList:TStringList; in_FieldNameList:=TStringList.Create(); ClothDataModule.m_Table.GetFieldNames(in_FieldNameList);
in_PriKey:=in_FieldNameList.Strings[0];
ClothDataModule.m_Table.Last;
ClothDataModule.m_Table.Insert;
ClothDataModule.m_Table.FieldByName(in_PriKey).AsString:='new';
ClothDataModule.m_Table.Post;