如何更新第一条记录然后发送电子邮件问题 [英] How to get first record updated then send email problem

查看:77
本文介绍了如何更新第一条记录然后发送电子邮件问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好我有问题



此代码每5分钟发一次基于计时器的电子邮件



它工作正常但我的问题我需要确定第一个rcord更新未插入



并发送电子邮件这是开始工作



这是我的代码



timer1_Tick

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





假设订单号14已发货数量更新为10(表示0为10)



然后发送电子邮件开始工作



之后任何更新到任何记录都不发送



没问题我不需要任何发送电子邮件代码但如何获得记录更新



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

推荐答案

销售标题]。 No_) AS [م],dbo。[Jeddah-Live
Sales Header].No_) AS [م], dbo.[Jeddah-Live


销售热线]。[凭证编号] AS ' رقمالطلب'
dbo。 [Jeddah-Live
Sales Line].[Document No_] AS 'رقم الطلب', dbo.[Jeddah-Live


Sales Header]。[Bill-to Name] AS ' العميل',dbo。[Jeddah-Live
Sales Header].[Bill-to Name] AS 'العميل', dbo.[Jeddah-Live


这篇关于如何更新第一条记录然后发送电子邮件问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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