473,402 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Update database field

If I've two tables with their values:
cars(carNo,name,color,model,existedquantity) 2-
CustomerOrders(orderNo,carNo,ordered,orderedquanti ty,orderdate)

I made for each one of them a form by the Windows Form Designer in the
vb.net plate to record data through these forms.

By the way I'm working on an Access db and on the (imports
system.data.oledb provider).

How can I make the( existedquantity) column in the "cars" table
decreases for each ordered car according to the (orderedquantity)
column from the "CustomerOrders"table.

Jun 1 '06 #1
1 1079
Zoneal,

There are thousands answers possible on the way you have made your question.

When I look at your question than the most simple answer is.

Create an SQL statement that does that and process that using

OleDb.OleDBCommand.ExecuteNonQuery

If you want it in VB.Net than it is a question of creating Two DataTables.
Using a relation Cars -> CustomerOrders and do that action in the parent
based on every CustomerOrderRow Child in a For each loop and update the
table than again.

Be aware that what you are doing is a very riscy operation. Doing this twice
will give direct wrong information. It is in my idea better to keep in this
case a field ordered Cars in your Car table, count that in the same way
starting at zero and than subtract that from your field exisitedquantity
giving the economicQuantity (I don't know if this word exist in English).

I hope this helps,

Cor

<zo****@yahoo.com> schreef in bericht
news:11**********************@f6g2000cwb.googlegro ups.com...
If I've two tables with their values:
cars(carNo,name,color,model,existedquantity) 2-
CustomerOrders(orderNo,carNo,ordered,orderedquanti ty,orderdate)

I made for each one of them a form by the Windows Form Designer in the
vb.net plate to record data through these forms.

By the way I'm working on an Access db and on the (imports
system.data.oledb provider).

How can I make the( existedquantity) column in the "cars" table
decreases for each ordered car according to the (orderedquantity)
column from the "CustomerOrders"table.

Jun 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jim S. | last post by:
I'm having a horrible time simply inserting the date in a MySQL database through a Visual Basic program. I have a table, called "ORDERS"; "ID" is the primary key. I'm trying the insert the date,...
3
by: BlackFireNova | last post by:
This concerns an Access 2002 (XP) database. There are two fields, "Notes" (Memo Field) and "Notes Update" on a form (among others) which I am concerned with here. Problem: I need to be able...
13
by: Lyners | last post by:
I have a web page writen in ASP.NET that contains some javascript so that when a user presses a button, or edits a certain field in a datagrid, another cell in the datagrid is filled with a value....
3
by: Larry Woods | last post by:
I have a datagrid that is carrying all fields of a record...except one. Now I want to update the underlying database via a dataadapter. The update is working but the field that is "left out" is...
2
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
2
by: Miro | last post by:
I will ask the question first then fumble thru trying to explain myself so i dont waste too much of your time. Question / Statement - Every mdb table needs a PrimaryKey ( or maybe an index - i...
13
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever...
2
by: somacore | last post by:
Hello all, I am trying to implement a trigger on a Microsoft SQL Server 2000 database. I have created the trigger, and it works mostly like it should, however I have a slight problem I can't seem...
4
by: hapnendad | last post by:
In the question statement below Field names are in and variables are in (). All fields referenced are in what I have named the ‘PAR’ Table. Using MS Access 2003, I am working on a project...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.