Click here to Skip to main content
16,004,653 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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,

[Edit] Added Sql Server Tag [/Edit]
Posted
Updated 6-Apr-11 21:04pm
v3
Comments
Magnus Gudmundsson 7-Apr-11 2:37am    
Please rephrase question. It's not easy to decipher what it is that you want help with. :)
lakshmanriz 7-Apr-11 2:52am    
well
i have a table in my database which is used in my application.if we enter the details through UI ,those details will be added in to the data base.Till now we dont have any problem.Now what i am going to ask you is 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.
Sandeep Mewara 7-Apr-11 2:57am    
Not clear and does not make much of a sense. kindly re-phrase and elaborate a little.
lakshmanriz 7-Apr-11 3:07am    
well i want to send a message to the user's mobile when trigger fires.This is my actual problem

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.
 
Share this answer
 
v3
Comments
lakshmanriz 7-Apr-11 2:57am    
actually if anyone enter their details in the database we need to send a message to the mobile.
lakshmanriz 7-Apr-11 3:11am    
from the details page i dont have any problem.but we have to send the message to mobile through database .
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.
 
Share this answer
 
v2
Comments
lakshmanriz 7-Apr-11 3:06am    
how can i send a message to the user's mobile when trigger fires
Sandeep Mewara 7-Apr-11 3:13am    
Oh great! is that quick question?

common try something... make an effort.
lakshmanriz 8-Apr-11 1:16am    
It is not a common thing.Try to understand my problem exactly.Actually we have a device which accepts finger print data.whenever a user put his finger on the device,that will be stored in the database.at the time of storing we need to send a message to the user's mobile.Hope you can understand
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"
{
XML
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
 
Share this answer
 
Comments
lakshmanriz 8-Apr-11 1:15am    
Actually we have a device which accepts finger print data.whenever a user put his finger on the device,that will be stored in the database.at the time of storing we need to send a message to the user's mobile.Hope you can understand
Do you mean you want to prevent the user from inserting data to the database if he's not using your application. If that's the case you could use logon triggers (http://msdn.microsoft.com/en-us/library/bb326598.aspx[^]) to check if the incoming connection is from your application or not.
 
Share this answer
 
Comments
lakshmanriz 8-Apr-11 1:09am    
Thanks for your reply.but i want to send a message to the mobile when anyone inserts data into the database
lakshmanriz 8-Apr-11 1:15am    
Actually we have a device which accepts finger print data.whenever a user put his finger on the device,that will be stored in the database.at the time of storing we need to send a message to the user's mobile.Hope you can understand
Wendelius 8-Apr-11 1:31am    
Ok, how do you send the message, using email? If that's the case, your trigger could utilize: http://msdn.microsoft.com/en-us/library/ms190307.aspx
lakshmanriz 8-Apr-11 1:39am    
i dont want to send any email.Because everybody doesnot have email-id. i want to send an sms to mobile
Wendelius 8-Apr-11 1:42am    
Ok, One possibility would be to send the email to sms relay and using that the mail would be sent to the mobile using sms. However, you can add rtelevant information to a table when the trigger is fired and after that you query the information from that table and send it to the mobile using your application.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900