简体   繁体   English

使用VB.Net中的查询更新Access中的列

[英]Update column in Access using query in VB.Net

I need to update a column by adding a value in Access: 我需要通过在Access中添加值来更新列:

update table1 set column1 = column1+value

In the above, if column1 is null, then the table is not updated. 在上面,如果column1为null,则不更新表。

I need a function like in SQL Server: 我需要类似SQL Server中的功能:

update table1 set column1 = isnull(column1,0) + value

You do not give a data type for column1. 您没有为column1提供数据类型。 The string concatenator is & not +, so consider: 字符串连接器是&而不是+,因此请考虑:

UPDATE Table1  
SET Table1.AText = [AText] & "A", 
    Table1.ANumber = Nz([ANumber],0)+1;

In both these examples, the column (field) will be updated even if it is null. 在这两个示例中,即使列(字段)为空,也将被更新。

我认为如果您使用Access作为数据库(后端),则查询中没有选项

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM