hi
I want to fetch data from sql and use them to make a new data
I really like to store the records in variables and maybe do some operations on some of them ,
but the main point is to update three tables in ways that are not the same,
that means I need the raw data !

Recommended Answers

use them to make a new data

What exactly you are trying to do ?
are you trying to implement some encryption algorithm ?

Jump to Post

What do you mean by raw data? Querying the tables into a DataSet object is about as raw as it gets.

Jump to Post

I want to decide what to do due to the data values !

i really did not understand.

can you post some sample data for reference.

Jump to Post

are the tables related ?

Jump to Post

All 15 Replies

use them to make a new data

What exactly you are trying to do ?
are you trying to implement some encryption algorithm ?

no not an encryption
I want to decide what to do due to the data values !

What do you mean by raw data? Querying the tables into a DataSet object is about as raw as it gets.

I want to decide what to do due to the data values !

i really did not understand.

can you post some sample data for reference.

yes it is
see,
I have three tables,I want to change a value on one table according to data changes on the others
one will for example increase and the other will decrease

are the tables related ?

yes they are related by a primary key

if you wan to automate the process, a trigger will do the trick for you .

what do you mean ?
how can i use that trigger ?

since the tables are related, once the data in the master table changes its dependent records can be made to change accordingly (by implementing some business logic) using a trigger.

can you please post your table structure for reference.

the names and fields are in my language
but I'll show you how they are

SELECT
    شناسه
    , نوع برنج
    , قیمت هر کیلو
    , مقدار خرید به کیلو
    , تاریخ خرید
    , نحوه پرداخت
    , قیمت تمام شده
FROM
    rice.خريد;

SELECT
    شناسه
    , نوع برنج
    , قیمت هر کیلو خرید
    , قیمت هر کیلو فروش
    , مقدار فروش به کیلو
    , تاریخ فروش
    , نحوه پرداخت
    , پیش قسط
    , باقیمانده پول با احتساب سود
    , کل قیمت فروش
    , سود حاصل از فروش
FROM
    rice.فروش;

SELECT
    شناسه
    , نوع برنج
    , موجودی انبار
    , قیمت فروش
FROM
    rice.موجودی;

hope you can understand them :(

hope you can understand them :(

How ?

you can rename the tables to A ,B,C and post the structure and their relations.

table one :
Id (primary key)
name
buying price
amount
buying date
full price

table two :
Id (primary key)
name
buying price
selling price
amount
selling date
full price


table three:
Id (primary key)
name
amount remaining
selling price
**********************************

they are related by Id
I should mention that , I want table three to be changed when I sell or buy
the amount is important

why the fields

name
buying price

are repeating in both the tables ?

are you trying to create something like inventory management, where you maintain the incoming and outgoing stock and finally prepare reports on the transaction on periodic basic ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.