首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

缺少更新的或刷新的键列信息,该怎么解决

2012-01-16 
缺少更新的或刷新的键列信息IfYvbYesThenAdodc1.Recordset.Fields( 续借日期 )Format(Now,yyyy-mm-dd

缺少更新的或刷新的键列信息
If   Y   =   vbYes   Then
              Adodc1.Recordset.Fields( "续借日期 ")   =   Format(Now,   "yyyy-mm-dd ")
              Adodc1.Recordset.Update
              MsgBox   "续借成功 "
运行到Adodc1.Recordset.Update时出现这句   我用的是Access表连的,在取记录时代码如下
Adodc1.ConnectionString   =   "Provider=Microsoft.Jet.OLEDB.3.51;Persist   Security   Info=False;Data   Source= "   &   App.Path   &   "\tushu.mdb "
str   =   "select   a.图书号,b.图书名称,b.作者,b.版次,a.借书日期,a.续借日期 "
str   =   str   &   "   from   借还信息表   a   inner   join   图书信息表   b   on   a.图书号=b.图书号 "
str   =   str   &   "   where   (a.还书日期   is   null)   and   (a.续借日期   is   null)   "
str   =   str   &   "   and   (a.读者号= "   &   " ' "   &   Trim(Text1.Text)   &   " ' "   &   ")   order   by   a.图书号 "
Adodc1.RecordSource   =   str
Adodc1.Refresh
Set   DataGrid1.DataSource   =   Adodc1.Recordset
DataGrid1.Refresh

在网上搜索说是缺少主键   我开Access把里面的ID设成了主键   但还是不行

[解决办法]
ID要在查询语句的列名中
[解决办法]
楼上不错

热点排行