Click here to Skip to main content
15,889,874 members
Home / Discussions / Database
   

Database

 
QuestionInsert into Syntax error? Pin
mikhaelb23-Oct-04 12:54
mikhaelb23-Oct-04 12:54 
AnswerRe: Insert into Syntax error? Pin
Colin Angus Mackay23-Oct-04 14:02
Colin Angus Mackay23-Oct-04 14:02 
GeneralRe: Insert into Syntax error? Pin
jlawren723-Oct-04 14:08
jlawren723-Oct-04 14:08 
GeneralRe: Insert into Syntax error? Pin
Colin Angus Mackay23-Oct-04 14:29
Colin Angus Mackay23-Oct-04 14:29 
Generalsql to export access table to html file Pin
jlawren723-Oct-04 10:41
jlawren723-Oct-04 10:41 
GeneralRe: sql to export access table to html file Pin
afronaut24-Oct-04 6:46
afronaut24-Oct-04 6:46 
GeneralMS OLAP Visual C++ (.NET) samples Pin
Ilgar22-Oct-04 23:43
Ilgar22-Oct-04 23:43 
GeneralProblem with SQL Server RaiseError with C# Pin
Graham W22-Oct-04 0:58
Graham W22-Oct-04 0:58 
I have a C# application for generic database access that does all sorts of extra processing. It is a port of an existing COM application written in C++.

The application uses objects from Microsoft.Data.Odbc namespace.

So I'm opening an OdbcConnection
and using an OdbcDataApaptor for retrievals, and an OdbcCommand for executing updates using ExecuteNonQuery.

All is working fine except for one thing involving the SQL Server RaiseError command being executed in a trigger.

The code I'm using in the application for update commands is this:

public long ExecuteChangeQuery(string sSQL)
{
long lResult;

try
{
m_cmd.CommandText = sSQL;
lResult = m_cmd.ExecuteNonQuery();
}
catch(OdbcException e)
{
// log the exception
throw e;
}
return lResult;
}

Under normal circumstances everything is fine. And if a normal error occurs, such as a SQL syntax error, etc. the exception is caught as expected.

However when the SQL server trigger calls RaiseError with a severity level of 16, which should throw an exception. Nothing happens. No exception is thrown and the call to ExecuteNonQuery simply returns -1 to indicate that a rollback occurred.

The existing COM application works properly with the same trigger.

Any ideas as to what's going wrong, or what I'm not doing?

Help greatly appreciated.



GeneralSQL statement against MS access Pin
21-Oct-04 14:20
suss21-Oct-04 14:20 
GeneralRe: SQL statement against MS access Pin
afronaut21-Oct-04 14:43
afronaut21-Oct-04 14:43 
GeneralRe: SQL statement against MS access Pin
jlawren721-Oct-04 15:53
jlawren721-Oct-04 15:53 
GeneralRe: SQL statement against MS access Pin
afronaut24-Oct-04 6:11
afronaut24-Oct-04 6:11 
GeneralRecursive Triggers Pin
afronaut21-Oct-04 13:33
afronaut21-Oct-04 13:33 
GeneralRe: Recursive Triggers Pin
WoutL22-Oct-04 1:25
WoutL22-Oct-04 1:25 
GeneralSQL query - deleting main row, its related rows, and their related rows Pin
Luis Alonso Ramos21-Oct-04 8:58
Luis Alonso Ramos21-Oct-04 8:58 
GeneralRe: SQL query - deleting main row, its related rows, and their related rows Pin
TimWallace21-Oct-04 9:32
TimWallace21-Oct-04 9:32 
GeneralRe: SQL query - deleting main row, its related rows, and their related rows Pin
Luis Alonso Ramos21-Oct-04 9:53
Luis Alonso Ramos21-Oct-04 9:53 
GeneralADO question Pin
Tom Wright21-Oct-04 5:32
Tom Wright21-Oct-04 5:32 
GeneralDatalist with pages Pin
David Fawn21-Oct-04 5:03
David Fawn21-Oct-04 5:03 
QuestionWhy won't this update to my Database? Pin
fortyonejb21-Oct-04 4:52
fortyonejb21-Oct-04 4:52 
Generalupdating a database in C# Pin
steve_rm21-Oct-04 4:10
steve_rm21-Oct-04 4:10 
GeneralVB, ADO, XP - Which one is falling over?! Pin
Pete Belcher20-Oct-04 23:04
Pete Belcher20-Oct-04 23:04 
GeneralRe: VB, ADO, XP - Which one is falling over?! Pin
Michael Potter21-Oct-04 5:05
Michael Potter21-Oct-04 5:05 
GeneralSimple Question on Oracle dbms_utility.get_time Pin
devvvy20-Oct-04 20:34
devvvy20-Oct-04 20:34 
GeneralRe: Simple Question on Oracle dbms_utility.get_time Pin
DiWa20-Oct-04 22:44
DiWa20-Oct-04 22:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.