Hi guys i have problem

this code send email based on timer every 5 minutes

it working ok but my problem i need to determine first rcord updated not inserted

and send email this is starting work

this is my code

Sales.SalesClass SalesClass1 = new Sales.SalesClass();
DataTable dt = SalesClass1.ShowSalesData("Data Source=;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
dataGridView1.DataSource = dt;
namespace Sales
class SalesClass
public DataTable ShowSalesData(string ConnectionString)
SqlConnection con = new SqlConnection(ConnectionString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "showsales1";
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
DataTable dt = ds.Tables[0];
return dt;
SELECT     ROW_NUMBER() OVER (ORDER BY dbo.[Jeddah-Live$Sales Header].No_) AS [?], dbo.[Jeddah-Live$Sales Line].[Document No_] AS '??? ?????', 
dbo.[Jeddah-Live$Sales Header].[Bill-to Name] AS '??????', dbo.[Jeddah-Live$Sales Line].Area AS '??? ?????', dbo.[Jeddah-Live$Sales Line].Description AS '??????', 
dbo.[Jeddah-Live$Sales Header].[Pump No_] AS '??????', CAST(ROUND(dbo.[Jeddah-Live$Sales Line].Quantity, 0, 1) AS int) AS '???????', 
CAST(ROUND(dbo.[Jeddah-Live$Sales Line].[Quantity Shipped], 0, 1) AS int) AS '???????', CAST(ROUND(dbo.[Jeddah-Live$Sales Line].[Outstanding Quantity], 0, 
1) AS int) AS '??????? '
FROM         dbo.[Jeddah-Live$Sales Header] INNER JOIN
                      dbo.[Jeddah-Live$Sales Line] ON dbo.[Jeddah-Live$Sales Header].No_ = dbo.[Jeddah-Live$Sales Line].[Document No_] AND 
                      dbo.[Jeddah-Live$Sales Header].[Sell-to Customer No_] = dbo.[Jeddah-Live$Sales Line].[Sell-to Customer No_]

The code above not have any problem and working
When first record updated send email

Example to show

orderno quantity shipped quantity

12 20 0

13 30 0

14 25 0

15 22 0

suppose order no 14 shipped quantity updated be 10 (meaning 0 be 10

then send email with starting work

after this any updated to any record not send

no problem i dont need any send email code but how to get record updated first
i dont have update statment to data because this happen by dynamic nav erp solution

I've read this 4 times now and still don't get it.

Can you reword your question using clearer language - I'm sure your question can't be that difficult to explain!

Be a part of the DaniWeb community

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