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

Database

 
GeneralRe: Optimize an query select DB Pin
TuanNGUYEN19-Jan-09 20:04
TuanNGUYEN19-Jan-09 20:04 
GeneralRe: Optimize an query select DB Pin
Wendelius20-Jan-09 8:28
mentorWendelius20-Jan-09 8:28 
Question"begin catch" and "end catch" Pin
George_George19-Jan-09 2:38
George_George19-Jan-09 2:38 
AnswerRe: "begin catch" and "end catch" Pin
J4amieC19-Jan-09 4:02
J4amieC19-Jan-09 4:02 
GeneralRe: "begin catch" and "end catch" Pin
George_George19-Jan-09 18:41
George_George19-Jan-09 18:41 
AnswerRe: "begin catch" and "end catch" Pin
Rob Philpott19-Jan-09 6:29
Rob Philpott19-Jan-09 6:29 
GeneralRe: "begin catch" and "end catch" Pin
George_George19-Jan-09 18:40
George_George19-Jan-09 18:40 
GeneralRe: "begin catch" and "end catch" Pin
Rob Philpott19-Jan-09 23:13
Rob Philpott19-Jan-09 23:13 
Hey George,

Well, if I understand it right and that you have a simple stored proc which is just a single insert/update/delete etc. you won't be needing a transaction as the command will either succeed or fail, so no rollback will be needed.

In this case, from code, you can just call the stored proc directly. Should it fail (FK constraint for instance) this will be raised as an SQLException in the code. This comes for free, you don't need to do anything to get this.

If you've got a batch of commands which you want to work atomically (either all complete successfully or none do (rollback)) you'll want to wrap the sql in a transaction in the proc (as originally posted).

There is the ability to create transactions on the Connection object in code, but personally I wouldn't do this. Transactions should always be as small as possible, and you can't really control the scope as effectively.

Hope that makes some sort of sense.

Regards,
Rob Philpott.

GeneralRe: "begin catch" and "end catch" Pin
George_George20-Jan-09 3:01
George_George20-Jan-09 3:01 
GeneralRe: "begin catch" and "end catch" Pin
Rob Philpott20-Jan-09 3:13
Rob Philpott20-Jan-09 3:13 
AnswerRe: "begin catch" and "end catch" Pin
Wendelius19-Jan-09 7:06
mentorWendelius19-Jan-09 7:06 
GeneralRe: "begin catch" and "end catch" Pin
George_George19-Jan-09 18:51
George_George19-Jan-09 18:51 
GeneralRe: "begin catch" and "end catch" Pin
Wendelius20-Jan-09 6:39
mentorWendelius20-Jan-09 6:39 
AnswerRe: "begin catch" and "end catch" Pin
Hamid_RT22-Jan-09 23:18
Hamid_RT22-Jan-09 23:18 
QuestionConvert Columns as Rows Pin
Vignesh Krishnan19-Jan-09 1:40
Vignesh Krishnan19-Jan-09 1:40 
AnswerRe: Convert Columns as Rows Pin
Wendelius19-Jan-09 2:05
mentorWendelius19-Jan-09 2:05 
GeneralRe: Convert Columns as Rows Pin
Vignesh Krishnan19-Jan-09 3:12
Vignesh Krishnan19-Jan-09 3:12 
GeneralRe: Convert Columns as Rows Pin
Wendelius19-Jan-09 6:55
mentorWendelius19-Jan-09 6:55 
GeneralRe: Convert Columns as Rows Pin
Vignesh Krishnan19-Jan-09 8:45
Vignesh Krishnan19-Jan-09 8:45 
GeneralRe: Convert Columns as Rows Pin
swjam19-Jan-09 11:26
swjam19-Jan-09 11:26 
GeneralRe: Convert Columns as Rows Pin
Vignesh Krishnan20-Jan-09 2:10
Vignesh Krishnan20-Jan-09 2:10 
GeneralRe: Convert Columns as Rows Pin
ColinM12319-Jan-09 11:45
ColinM12319-Jan-09 11:45 
GeneralRe: Convert Columns as Rows Pin
Wendelius20-Jan-09 8:17
mentorWendelius20-Jan-09 8:17 
GeneralRe: Convert Columns as Rows Pin
Wendelius20-Jan-09 8:15
mentorWendelius20-Jan-09 8:15 
QuestionMS Access Query: Bit value in a Where Clause Pin
swjam19-Jan-09 0:03
swjam19-Jan-09 0:03 

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.