如何在asp.net中显示警报...在数据库中插入新行或记录更新? [英] How to Show alerts in asp.net ... when a new row inserted or record updated in Database?
本文介绍了如何在asp.net中显示警报...在数据库中插入新行或记录更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当插入新行或在数据库中更新记录时....系统将如何找到新记录或在数据库中更新旧记录?
when a new row inserted or record updated in Database.... How will system find that a new record is created or an older record is updated in database??
推荐答案
有很多方法可以显示消息...
1.使用Session(SuccessMsg)=数据已成功插入。并将此会话用于label.text。
2.使用注册启动脚本使用Javascript警报(数据已成功插入):Registerstartupscript-vs
3. 显示警报消息
There are many ways to display messages...
1. Using Session("SuccessMsg") = "Data Inserted Successfully." and using this session to your label.text.
2. Using Javascript alert("Data Inserted Successfully") using register startup script : Registerstartupscript-vs
3. Display Alert Message
< br>
//查询
//query
int a = cmd.ExecuteNonQuery();
If(a>0)
{
ScriptManager.RegisterStartupScript(this, GetType(), "message",
"alert('Data Inserted Successfully');", true);
}
else
{
ScriptManager.RegisterStartupScript(this, GetType(), "message",
"alert('Error');", true);
}
这篇关于如何在asp.net中显示警报...在数据库中插入新行或记录更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文