ASP.NET:插入 Gridview 行后发送电子邮件
我有一张这样的两张桌子;
Table Name: PROSPECT // Columns --> (CUSTOMER, YAT_ADET, FILO)
Table Name: TEMSILCI // Columns --> (CUSTOMER, MAIL)
基本上,当我插入 PROSPECT
表的 Gridview
3 数据时,我想向 CUSTOMER
发送电子邮件。但是 TEMSILCI
表中的邮件地址数据。因此,在插入行后,我应该获取客户的邮件地址。
我的 SqlDataSource 的 InsertCommand
是;
InsertCommand="INSERT INTO PROSPECT(CUSTOMER, YAT_ADET, FILO) VALUES (@CUSTOMER, @YAT_ADET, @FILO)"
我认为,我的场景应该;
- 获取插入到 Gridview 中的 CUSTOMER 值。
- 使用类似
SELECT MAIL FROM TEMSILCI WHERE CUSTOMER = 'Inserted CUSTOMER'
的查询执行并获取邮件地址。 - 之后,将邮件地址应用到我已经编写的
SendMail()
函数中。
我正在考虑使用 RowInserted
事件。
protected void ASPxGridView1_RowInserted(object sender, DevExpress.Web.Data.ASPxDataInsertedEventArgs e)
{
}
但是我该如何准确执行步骤 1
和 2
? AND,如何以编程方式获取 SqlDataSource Inserted 参数的值?
I have a two table like this;
Table Name: PROSPECT // Columns --> (CUSTOMER, YAT_ADET, FILO)
Table Name: TEMSILCI // Columns --> (CUSTOMER, MAIL)
Basicly, When I Inserted to Gridview
3 data for PROSPECT
table, I want to send an e-mail to CUSTOMER
. But Mail address data in TEMSILCI
table. So, I should get, after the row inserted, CUSTOMER's mail address.
My SqlDataSource's InsertCommand
is;
InsertCommand="INSERT INTO PROSPECT(CUSTOMER, YAT_ADET, FILO) VALUES (@CUSTOMER, @YAT_ADET, @FILO)"
I think, my scenario should;
- Get the CUSTOMER value which inserted to
Gridview
. - Execute and get mail address with query like
SELECT MAIL FROM TEMSILCI WHERE CUSTOMER = 'Inserted CUSTOMER'
- After that, apply mail address to my already written
SendMail()
function.
I'm thinking to use RowInserted
Event.
protected void ASPxGridView1_RowInserted(object sender, DevExpress.Web.Data.ASPxDataInsertedEventArgs e)
{
}
But how can I exactly do step 1
and 2
? AND, How can I get SqlDataSource Inserted parameter's value programmatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过 SCOPE_IDENTITY / @@IDENTITY 运行并合并所需的电子邮件消息。请参阅 DevExpress 支持中的 http://www.devexpress.com/issue=Q299244 讨论中心。希望这有帮助。
You can capture the newly inserted data record's ID via the SCOPE_IDENTITY / @@IDENTITY function and combine a required email message. Refer to the http://www.devexpress.com/issue=Q299244 discussion in the DevExpress support center. Hope this helps.
我找到了解决方案
此代码将
YAT_PLAN
列的值插入到ASPxGridview
中。I found the solution
This code getting inserted value of
YAT_PLAN
column toASPxGridview
.