如何使用VB.NET更新MS Access DB中的特定记录 [英] How to update specific record in MS Access DB using VB.NET

查看:101
本文介绍了如何使用VB.NET更新MS Access DB中的特定记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个图书馆系统,该系统的一部分将计算任何滞纳金.现在需要将系统为会员计算的滞纳金添加到会员记录中,我该如何实现.

例如,发生了会员ID 1的滞纳金£2.40,现在必须将此费用添加到他的记录中,其中包括他们的会员ID,姓名,地址,电话号码和滞纳金..

£2.40必须在其记录的滞纳金部分中进行更新/添加

如何实现这一目标,我似乎无法解决.

有人可以指导我实现这一目标吗?

感谢

Im creating a library system and part of the system calculates any late fees. Now the late fee that the system calculates for the member needs to be added to the members record, how can i achieve this.

For e.g Member ID 1 has occurred a late fee of £2.40 now this fee must be added to his record which consists of their member id, name, address, telphone number and late fees..

The £2.40 must be update/added in the late fees part of his record

how can this be achieved i cant seem to work it out.

can someone kindly direct me to achieving this

thanks

推荐答案

您没有将其添加到成员记录中.您可以将其添加到一个单独的表(可能称为LateFees)中,并将成员的主键值用作滞纳金表中的外键.
You don''t add it to the members record. You add it to a seperate table, probably called LateFees, and use the members primary key value as the foreign key in the late fees table.


如果您的要求是仅存储一笔滞纳金对于每个成员,则可以通过PrimaryKey值(即MemberID)检索该成员的DataRow,并按如下所示设置滞纳金

If your requirement is to store only one late fee for each member then you can retrieve the DataRow for the member by the PrimaryKey value i.e. MemberID and set the late fee as below

Dim memberRow As DataRow = membersTable.Rows.Find(memberID)

If memberRow IsNot Nothing Then
    'Store the lateFee calculated in the LateFee field of the member row
    memberRow.Item("LateFee")= lateFee;
End If



如果您的问题已解决,则可以接受该解决方案并对其进行表决,否则,请发布您的查询.



You may accept and vote the solution if your problem is solved, otherwise please post your queries.


这篇关于如何使用VB.NET更新MS Access DB中的特定记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆