Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RAISERROR Problems

Status
Not open for further replies.

rossmcloughlin

Programmer
Oct 3, 2002
7
IE
Hi all,

This is my first time using this forum. I hope you can help me with a problem that must be fixed by the morning. The install date is tomorrow, and I can't get my head around the problem described below.

I use the RAISERROR statement in my update stored procedures. This was working fine in my production VB project. For example on one of my screens, the Applied date is required for all new records. On my production app, when I do not enter an Applied Date, I get the following error:

"Error: You must enter a valid Applied Date for new records
Source: Microsoft OLE DB Provider for SQL Server"

This is what I expected.

The code that handles the Error looks like:

-- Make sure that a valid Applied Date in entered
IF DATALENGTH(@Applied) = 0 OR @Applied Is Null
BEGIN
RAISERROR('You must enter a Date',16,1)
RETURN 0
END

However, when I compiled the project, I get a different error whenever I do not enter an Applied Date. The error does not make any sense. It is:

"Error: Method '~' of object '~' failed
Source: Grant Administration"

As you can see, the error is not being raised properly back to the client. I have gone into Tool|Options and set Error Handling to "Break on all Unhandled Errors". What am I missing?

Cheers...

Ross
 
Could someone recommend another forum that might be able to shed some light on my problem?
 
By the error you are seeing, it really looks like VB is returning the error and not SQL Server. Are you sure the VB code is the same (no typos)?

-SQLBill
 

I still haven't fixed the problem. The code works fine before I compile the application. Everything works as I expect it to. The error only appears following a compile.
 

Hi all,

I think I found the source of my problem.

Thanks anyways!

Ross
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top