all groups > dotnet datatools > june 2005 >
You're in the

dotnet datatools

group:

Working with stored procedure transactions in .NET


Working with stored procedure transactions in .NET Luis Rivas via .NET 247
6/7/2005 11:27:45 AM
dotnet datatools:
Hi All,

I'm trying to work with stored procedure in VB.NET but there were some problems with that, I hope someone can help me.
First, is there a way to manage a stored procedure's transaction from VB.NET?, I tried something like this (see code below) but when I do commit an error appears because the transaction is already closed.

................
Dim objConexion As New OleDbConnection(strConexion)
Dim trans As OleDbTransaction
Dim objComando As OleDbCommand = New OleDbCommand("fun_codigos", objConexion)
objComando.CommandType = CommandType.StoredProcedure

.......defining parameters...............

objConexion.Open()
trans = objConexion.BeginTransaction
objComando.Transaction = trans
Dim objDataReader As OleDbDataReader = objComando.ExecuteReader
objDataReader.Close()
objConexion.Close()

Dim salida As Int64
salida = objComando.Parameters("@p_cod_servicio").Value
Label1.Text = salida
trans.Commit() -------> here an error appears!

I have to manage the transaction from VB.Net not from inside the stored procedure.

Second, I want to pass some parameters from VB.NET to an stored procedure but there is an error like this: "ORA-06550: line 1, column 18: PLS-00382: expression is of wrong type ORA-06550: line 1, column 7: PL/SQL: Statement ignored "
I checked parameter's type in VB.NET and there were the same as in stored procedure.

I'm working with Oracle 8i.

I hope you can help me.

Thanks in advance

--------------------------------
From: Luis Rivas

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

Re: Working with stored procedure transactions in .NET Miha Markic [MVP C#]
6/10/2005 9:44:16 AM
Hi Luis,

1. You have to Commit (or Rollback) transaction before you close the
connection.
2. It is impossible to find the reason without seeing some code.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

[quoted text, click to view]

AddThis Social Bookmark Button