Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Sending and retreiving values from a Trigger

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-02-08 : 23:41:01
Anders writes "Dear Sir
My problem is this:
From a ASP-page i'm calling a Stored procedure for inserting some data. I also want to have a trigger that checks if the person that makes the contribution is allowed to do that.

The data that is supposed to get inserted into the database is forname and lastname of a person. The data i want to use is the userid from the person trying to make the contribution.

The call to the Stored procedure is something like this:
sSql = "sp_insertUser " & strFname & " , " & strLname & " , " & Session("User_ID")
objConn.Execute(sSql)

The Stored Procedure looks like this
CREATE PROCEDURE sp_insertUser @UserName varchar(16) , @PassWord varchar(16), @userId int AS
Insert INTO trigger_insert (tIn_fname, tIn_lname) VALUES( @UserName , @PassWord )


And so far so good this works

But i want a trigger that checks if userId is in the table "user". If it isn't i would like to be able to show an error message on the asp-page and NOT preforme the inserting.

I'm sorry about my bad english but i hope you can make something out of this.

I'm trying to do this on MS SQLServer 7.0 and the machine runs on Windows 2000 server.


Yours Sincerelly
Anders Hansson
Sweden"
   

- Advertisement -