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
---timer1_Tick---
Sales.SalesClass SalesClass1 = new Sales.SalesClass();
DataTable dt = SalesClass1.ShowSalesData("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
dataGridView1.DataSource = dt;
dataGridView1.Refresh();
------
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();
da.Fill(ds);
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