当任何人想要在数据库中插入数据时,在应用程序中显示警报消息 [英] show an alert message in the application when anyone wants to insert the data in the database

查看:72
本文介绍了当任何人想要在数据库中插入数据时,在应用程序中显示警报消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,

当任何人想要将数据直接插入数据库时​​,我们必须在应用程序中显示一条消息(当它已经在运行时).

任何人都可以帮忙吗,





谢谢,

添加了Sql Server标记[/Edit]

Sir,

When anyone wants to insert the data into the database directly ,we have to display a message in the application(when it is already in running).

can anyone help in this,





Thanks,

Added Sql Server Tag [/Edit]

推荐答案

从理论上讲,您可以通过以下两种方式之一进行操作:
1)监视进入数据库服务器的所有数据流量,并监视INSERT命令.不太适合ASP.NET,而且绝对不适合完全加载的Guru™之外的任何人.
2)您可以在数据库上设置一个触发器,在尝试插入时将触发该触发器.不容易-我不想这样做-会使普通用户放慢速度.

您为什么要这样做有充分的理由?因为如果是一时兴起,老实说,我会忘记的...


实际上,如果有人在数据库中输入他们的详细信息,我们需要向手机发送消息."


然后在详细信息页面本身中,在后面的代码中进行操作.
IE.当您要将验证后的数据发送到数据库,并准备构造Sql INSERT语句时,也将其发送到SMS.

从详细信息页面我没有任何问题.但是我们必须通过数据库将消息发送到手机."

不能这样工作:SQL Server无法与调制解调器对话,语言不够灵活.
唯一的其他方法是拥有一个单独的应用程序来执行SMS.您可以设置一个单独的"Need SMS"表,该表由应用程序连续监视,但是这会浪费带宽等等.最好向应用程序发送一条消息,要求它是SMS,然后让它处理.
In theory you could do it in one of two ways:
1) Watch all data traffic into the database server and monitor for INSERT commands. Not really suitable for ASP.NET and definately not for anyone less than a fully loaded Guru™
2) You could set a trigger on the database that fires when an insert is attempted. Not easy - I wouldn''t want to do it - and would slow down normal users.

Is there a good reason why you want to do this? Because if it is a whim, I''d forget it, to be honest...


"actually if anyone enter their details in the database we need to send a message to the mobile."


Then do it from the details page itself, in the code behind.
I.e. When you are about to send the validated data off to your database, and are ready to construct the Sql INSERT statement, send it to an SMS as well.

"from the details page i dont have any problem.but we have to send the message to mobile through database ."

Doesn''t work that way: SQL server cannot talk to the modem, the language is not flexible enough.
The only other way to do it is to have a separate application which does the SMS. You could set up a separate table of "Need SMS" which is continually monitored by the app, but that would waste bandwidth and so forth. Better to send a message to the app that an SMS is required and let it deal with it.


如果有人想将数据直接插入数据库中,我需要提出一个应用程序中已处于运行状态的消息
AFAIK,不可能.

数据库和您的应用程序之间并没有相互连接.最多,您可以在表插入上写一个TRIGGER,该日志可以记录或通过电子邮件发送给他人作为通知.更改数据库数据后,您将无法在某些应用程序中弹出消息.

或者,您可以从数据库启动应用程序,并处理应用程序中的工作流程以向用户显示一些内容.
if anyone wants to insert the data directly in the database i need to raise a message in the application when it is already in running state
AFAIK, Not possible.

Database and your application are not connected to each other as such. Maximum, you can write a TRIGGER on the table insert that can log or email someone as a notification. You cannot popup a message in some application on change of a database data.

Alternatively, you can launch the application from database and handle the workflow in your application to show something to the user.




您可以通过以下方式向用户发送警报消息,

首先,当数据成功插入数据库后,您必须从数据库返回一些结果,然后
您可以将结果检查到后面的代码中,并显示这样的警报消息,

如果Result ="SUCCESS"
{
Hi,

you can give alert message to user by using following way,

First you have to return some result from database when your data is successfully inserted into database then
you can check your result into code behind and show alert message like this,

if Result="SUCCESS"
{
StringBuilder sb = new StringBuilder();
sb.Append("<script type='text/javascript'>");
sb.Append("alert('Successfully Inserted');");
sb.Append("</script>");
ClientScript.RegisterClientScriptBlock(this.GetType(), "Insert Script", sb.ToString());



}

希望对您有帮助.
一切都很好



}

I hope this will help you.
All d best


这篇关于当任何人想要在数据库中插入数据时,在应用程序中显示警报消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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