Click here to Skip to main content
15,908,842 members
Home / Discussions / Database
   

Database

 
AnswerRe: Stored procedure in postgresql ? Pin
leckey28-Jul-09 4:18
leckey28-Jul-09 4:18 
AnswerRe: Stored procedure in postgresql ? Pin
valeranavin28-Jul-09 17:04
valeranavin28-Jul-09 17:04 
QuestionTransaction, RollBack, CommitTransaction Pin
Sanket.Patil27-Jul-09 21:26
Sanket.Patil27-Jul-09 21:26 
AnswerRe: Transaction, RollBack, CommitTransaction Pin
Muhammad Shahid Farooq28-Jul-09 0:28
professionalMuhammad Shahid Farooq28-Jul-09 0:28 
AnswerRe: Transaction, RollBack, CommitTransaction Pin
DoctorMick28-Jul-09 1:18
DoctorMick28-Jul-09 1:18 
GeneralRe: Transaction, RollBack, CommitTransaction Pin
Sanket.Patil28-Jul-09 1:34
Sanket.Patil28-Jul-09 1:34 
AnswerRe: Transaction, RollBack, CommitTransaction Pin
Robin_Roy29-Jul-09 17:59
Robin_Roy29-Jul-09 17:59 
AnswerRe: Transaction, RollBack, CommitTransaction Pin
www.Developerof.NET29-Jul-09 22:29
www.Developerof.NET29-Jul-09 22:29 
use this,


cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = "Your_SP";
            cmd.CommandType = CommandType.StoredProcedure;
            if (con.State != ConnectionState.Open)
                con.Open();
            cmd.Transaction = con.BeginTransaction();
            
            try
            {
                parentmainid=Subroutine_For_Parent_Insert(userid);
                for (items = 0; items <= _alldata.Count - 1; items++)
                {
                    Subroutine_For_Child_Insert(parentmainid,childdata);
                }
                cmd.Transaction.Commit();
                _status = true;
            }
            catch (Exception e)
            {
                cmd.Transaction.Rollback();
                _status = false;
            }


Some important points :

1>Remember to declare cmd as global or pass it as byreference.
2> Do not reinitialze the connection in any of the functions.
3> Use cmd.Parameters.clear() on every function call or else you would get a "Too many parameters error".
4> Do not reinitialize the cmd object during the transaction or else the transaction will lose the data and won`t be rolled back.

When you fail to plan, you are planning to fail.

Questionmysql, query performance question Pin
mark_me27-Jul-09 16:08
mark_me27-Jul-09 16:08 
AnswerRe: mysql, query performance question Pin
Adam Maras27-Jul-09 16:27
Adam Maras27-Jul-09 16:27 
GeneralRe: mysql, query performance question Pin
mark_me28-Jul-09 5:06
mark_me28-Jul-09 5:06 
AnswerRe: mysql, query performance question Pin
Mycroft Holmes27-Jul-09 17:40
professionalMycroft Holmes27-Jul-09 17:40 
GeneralRe: mysql, query performance question Pin
mark_me28-Jul-09 5:07
mark_me28-Jul-09 5:07 
AnswerRe: mysql, query performance question Pin
Robin_Roy27-Jul-09 18:06
Robin_Roy27-Jul-09 18:06 
QuestionSQL Stored Procedure push in the right direction :) Pin
cdietschrun27-Jul-09 10:46
cdietschrun27-Jul-09 10:46 
AnswerRe: SQL Stored Procedure push in the right direction :) Pin
Mike Ellison27-Jul-09 14:35
Mike Ellison27-Jul-09 14:35 
QuestionSSIS Package - Urgent need Help Pin
vasini27-Jul-09 7:39
vasini27-Jul-09 7:39 
AnswerRe: SSIS Package - Urgent need Help Pin
Abhijit Jana27-Jul-09 8:31
professionalAbhijit Jana27-Jul-09 8:31 
AnswerPlease Read Forum Guidelines Pin
leckey27-Jul-09 10:42
leckey27-Jul-09 10:42 
AnswerRe: SSIS Package - Urgent need Help Pin
Robin_Roy27-Jul-09 17:04
Robin_Roy27-Jul-09 17:04 
QuestionLoosing decimal values while selecting in Oracle Pin
sandhya1426-Jul-09 20:11
sandhya1426-Jul-09 20:11 
AnswerRe: Loosing decimal values while selecting in Oracle Pin
Mycroft Holmes26-Jul-09 20:54
professionalMycroft Holmes26-Jul-09 20:54 
GeneralRe: Loosing decimal values while selecting in Oracle Pin
sandhya1426-Jul-09 21:06
sandhya1426-Jul-09 21:06 
Questionhow to do this result output Pin
VinothRao26-Jul-09 17:53
VinothRao26-Jul-09 17:53 
AnswerRe: how to do this result output Pin
Robin_Roy26-Jul-09 18:14
Robin_Roy26-Jul-09 18:14 

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.