Ultimate Collection - { fslBlog & faisalmb.com } Ultimate Collection - { fslBlog & faisalmb.com }   
Blog   |   Site   |   Posts (347)   |   Tags Xplorer   |   Feed Subscribe Free! Now surfing... Sign in    Partner Site - Real Home Contact Search   

Wed

31

Dec

2008

Wed-31-12-2008
   

Implementing Transaction in Stored Procedure



Sample Code Oracle stored procedure - In this simple implementation, call commit at the end of work done, and Rollback if any exception occur.

 

PROCEDURE SAVE_TWO_THINGS(
IN_THING_ONE IN VARCHAR2,
IN_THING_TWO IN VARCHAR2)
IS

BEGIN

INSERT INTO TABLEONE
(ACTIVE, THING_DESC)
VALUES
('Y', IN_THING_ONE);


INSERT INTO TABLETWO
(ACTIVE, THING_DESC)
VALUES
('N', IN_THING_TWO);

COMMIT;

EXCEPTION WHEN OTHERS THEN 
ROLLBACK;
END;


Wed

31

Dec

2008

Wed-31-12-2008
   

Implementing Transaction in .NET



Today I need to implement transaction in .NET. Front end language was VB.NET and database was Oracle.

This transaction is being implemented using Oracle Data Access Provider - ODP.NET.

Simple implementation is that create and open a connection, begin transaction using that connection, create command using that connection, call stored procedures or statments using command(s), if every thing gone fine and success then call commit of that transaction else rollback, and in last close and dispose connection and transaction.

Be sure not to use commit, rollback or statement that causes transaction invalidate inside the procedure that is being called within .NET transaction, otherwise that .NET transaction scope will no longer valid as within that connection commit or rollback have been called.

Sample code that make my work done is :-

=============

Private Sub Save()
Dim conn As New OracleConnection("ConnString")
Dim trans As OracleTransaction
Dim success as Boolean = False

Try
conn.Open()
 trans = conn.BeginTransaction
success =  saveThingOne(conn)
If success Then
success = saveThingTwo(conn)
End If

If success  Then
 trans.Commit()
else
trans.Rollback()
End If

Catch ex As Exception
 trans.Rollback()
Finally
trans.Dispose()
conn.Close()
conn.Dispose()
End Try
End Sub



Private Sub saveThingOne(ByVal conn As OracleConnection) As Boolean
Dim success as Boolean = False
Using comm As New OracleCommand("Save_Thing_One_Stored_Procedure", conn)
   comm.CommandType = CommandType.StoredProcedure
   comm.Parameters.Add("IN_ID", OracleType.Number).Value = intID
   comm.Parameters.Add("IN_THING_ONE", OracleType.VarChar, 60).Value = strThingONe
   comm.Parameters.Add("OUT_RESULT", OracleType.Number).Direction = ParameterDirection.Output
   comm.ExecuteNonQuery()
‘Here if that procedure successfully perform action then will return 0 in case of success and 1 in case of failure
success = Iif(comm.Parameters(“OUT_RESULT”).Value.ToString().equals(“0”), True, False)
Return success
End Using
End Sub



Private Sub saveThingTwo(ByVal conn As OracleConnection)
Dim success as Boolean = False
Using comm As New OracleCommand("Save_Thing_Two_Stored_Procedure", conn)
   comm.CommandType = CommandType.StoredProcedure
   comm.Parameters.Add("IN_ID", OracleType.Number).Value = intID
   comm.Parameters.Add("IN_THING_TWO", OracleType.VarChar, 60).Value = strThingTwo
   comm.Parameters.Add("OUT_RESULT", OracleType.Number).Direction = ParameterDirection.Output
   comm.ExecuteNonQuery()
‘Here if that procedure successfully perform action then will return 0 in case of success and 1 in case of failure
success = Iif(comm.Parameters(“OUT_RESULT”).Value.ToString().equals(“0”), True, False)
Return success

End Using
End Sub

 

 


Tue

30

Dec

2008

Tue-30-12-2008
   

Isnt Israel doing terrorism in Palestine - Media Pictures Photos 4



Isnt Israel doing terrorism in Palestine - Media Pictures Photos_31.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_32.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_33.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_34.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_35.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_36.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_37.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_38.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_39.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_40.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_41.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_42.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_43.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_44.jpg

Isnt Israel doing terrorism in Palestine - Media Pictures Photos_45.jpg


Sun

28

Dec

2008

Sun-28-12-2008
   

Rebranding due to Financial Crisis



Cool rebranding due to financial crisis... 3m, apple, cisco, citigroup, dell, ferrari, ford, goodyear, jones, lg, nike, nokia, xerox, yahoo....

 

rebrand 3m.jpg

rebrand apple.jpg

rebrand buy.jpg

rebrand cisco.jpg

rebrand citi.jpg

rebrand dell.jpg

rebrand ferrari.jpg

rebrand ford.jpg

rebrand goodyear.jpg

rebrand jones.jpg

rebrand lg.jpg

rebrand nike.jpg

rebrand nokia.jpg

rebrand ssler.jpg

rebrand xerox.jpg

rebrand yahoo.jpg


Fri

26

Dec

2008

Fri-26-12-2008
   

Dedicated to Quaid-e-Azam Muhammad Ali Jinnah



aik tu jis nay chaman say phool cheen kar hamay dia
aik hum jo is ko gulshan bana na sakay

aik tu jo gardish-e-zamanay say takra gaya
aik hum nidamat say sar utha bhi na sakay

aik tu jo shama jalata tha hawa k rukh par
aik hum jo shama ko bujhnay say bacha bhi na sakay

 


Fri

26

Dec

2008

Fri-26-12-2008
   

Founder of Pakistan - We are proud of him - The great leader



Hum laye hain kashti ko toofaan say nikal kay... is mulk ko rakhna tum sambhal kay....

The great leader of Pakistan, Quaid-e-Azam, Muhammad Ali Jinnah - On this birth day...

 jinnah1.jpg

I(Doc Kazi of flickr) got this rare photgraph from Mahmood on Victoria Road. He could not identify the others although the man in the center resembles the Nawab of Jungadh. The British General resembles Gen Musa. Mr Jinnah seems in a relaxed mood ostensibly with his favorite 'Craven A' cigarettes, which finally got him

 quaid-british.jpg

In 1916, an even younger Mr Jinnah(in front center, mustachioed) presiding over a joint meeting of Indian National Congress and All India Muslim League.

 quaid-meeting.jpg

 

Mayor of Karachi Hakim M Ahsan hosts a reception for the Governor General of Pakistan on Aug 25, 1947.

 quaid-mayor.jpg

Quaid visiting PAF base Risalpur, 1947.

 MA_Jinnah_at_Risalpur_1.jpg

 

MA_Jinnah_at_Risalpur_2.jpg

 

MA_Jinnah_at_Risalpur_3.jpg

Quaid with Moutbaten

 quaid-mountbaten233331634_8911330.jpg

Quaid with Liaquat Ali Khan

 quaid-liaquat21634_4060182.jpg

 

Nawabzada Nasurallah escorts Mr. Jinnah

 quaid-welcome2.jpg

 

quaid-welcome.jpg

 

The Founder with Field Marshal Auchinleck

 quaid-auchinleck.jpg

The Founder addresses the Muslim League Session, Allahabad 1942

quaid-muslim-league.jpg

Smiling Jinnah in Bombay

quaid-smiling.jpg 

 


Thu

25

Dec

2008

Thu-25-12-2008
   

Linux environment in Windows



This is good for those who are interested in linux
 
GNU + Cygnus + Windows = Cygwin
 
Cygwin is a Linux-like environment for Windows
 
 
 

Thu

18

Dec

2008

Thu-18-12-2008
   

Durood - Blessings



durood.jpg


Categories : Reality of Islam


Wed

17

Dec

2008

Wed-17-12-2008
   

Blessings



BismiLlahir Rehmaanir Raheem
Hadiths MuhammadurRasooluLlah sallallaho alaihi wassallam from Sahih Bukhari
 
 
Volume 2, Book 21, Number 226:
Narrated Um Salama (radi Allaho anho):
One night the Prophet (sallallaho alaihi wassallam) got up and said, "Subhan Allah! How many afflictions Allah has revealed tonight and how many treasures have been sent down (disclosed). Go and wake the sleeping lady occupants of these dwellings up (for prayers), perhaps a well-dressed in this world may be naked in the Hereafter." 
 
 
Volume 2, Book 21, Number 230:
Narrated Al-Mughira (radi Allaho anho):
The Prophet (sallallaho alaihi wassallam) used to stand (in the prayer) or pray till both his feet or legs swelled. He was asked why (he offered such an unbearable prayer) and he (sallallaho alaihi wassallam) said, "should I not be a thankful slave." 
 
 
Volume 2, Book 21, Number 243:
Narrated Abu Huraira (radi Allaho anho)
Allah's Apostle (sallallaho alaihi wassallam) said, "Satan puts three knots at the back of the head of any of you if he is asleep. On every knot he reads and exhales the following words, 'The night is long, so stay asleep.' When one wakes up and remembers Allah, one knot is undone; and when one performs ablution, the second knot is undone, and when one prays the third knot is undone and one gets up energetic with a good heart in the morning; otherwise one gets up lazy and with a mischievous heart." 
 
 
Volume 2, Book 21, Number 245:
Narrated 'Abdullah (radi Allaho anho):
A person was mentioned before the Prophet (sallallaho alaihi wassallam) and he was told that he had kept on sleeping till morning and had not got up for the prayer. The Prophet (sallallaho alaihi wassallam) said, "Satan urinated in his ears."
 
 
Volume 2, Book 21, Number 264:
Narrated Abu Qatada bin Rabi Al-Ansari (radi Allaho anho);
The Prophet (sallallaho alaihi wassallam) said, "If anyone of you enters a Mosque, he should not sit until he has offered a two-Rakat prayer." 
 
 
Volume 2, Book 21, Number 276:
Narrated Aisha (radi Allaho anho):
The Prophet (sallallaho alaihi wassallam) never missed four Rakat before the Zuhr prayer and two Rakat before the Fajr prayer. 
 
 
Volume 2, Book 21, Number 280:
Narrated Ibn 'Umar (radi Allaho anho),
Allah's Apostle (sallallaho alaihi wassallam) said, "Offer some of your prayers in your houses and do not make them graves." 
 
 
Volume 2, Book 21, Number 282:
Narrated Abu Huraira (radi Allaho anho)
Allah's Apostle (sallallaho alaihi wassallam) said, "One prayer in my Masjid is better than one thousand prayers in any other mosque except Al-Masjid-Al-Haram." 
 
Volume 2, Book 21, Number 287:
Narrated Abu Huraira (radi Allaho anho):
The Prophet (sallallaho alaihi wassallam) said, "Between my house and my pulpit there is a garden of the gardens of Paradise, and my pulpit is on my fountain tank (i.e. Al-Kauthar)." 
 
 

Wed

17

Dec

2008

Wed-17-12-2008
   

I am Pakistan



I am Pakistan, I am responsible for my today too.

 i am pakistan.JPG


Categories : Thoughts / Lessons





Intro

Faisal Bashir
Consultant / Software Architect
KalSoft Limited
Microsoft Certified Technology Specialist.
Currently in Dubai. [more]

Right Now

How could u reach the pearl by only looking at the sea? if u seek the pearl, be a diver: the diver needs several qualities, he must trust his rope and his life to the Friend's hand, he must stop breating and he must jump - Jalaluddin Rumi.

Recent Comments

Comment RSS

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar

And Allah has created every animal from water. Of them are one that walks on their belly and of them are one that walks on two feet, and of them are one that walks on four feet. Allah creates whatever He will. Undoubtedly, Allah is Powerful over everything. (Holy Quraan - Al Noor 24-45)
376927 hits. (Best viewed @ 1024x768 resolution min.) Comments here...
© 2001-2011 Muhammad Faisal | Disclaimer | Contact | Partner Site