StoredProc commits results in QueryAnalyzer but not in ADO.NET
- From: tracybannon@xxxxxxxxxxxx
- Date: 19 Aug 2006 07:47:18 -0700
I'm hoping someone can help!
I have a stored procedure in an MSDE database. When I use Query
Analyser to run this stored procedure the correct results appear in the
database. My stored procedure returns resultCode.
The stored procedure includes a single
BEGIN TRANSACTION
[...]
COMMIT TRANSACTION
Within my application, I execute the follow code I recieve the correct
result code but the information is NOT updated in teh database. I have
tried with and without ADO transactions.
public int CreateFrame(string BRKEY, string INSPKEY, string USERKEY)
{
//System.Data.OleDb.OleDbTransaction frameTransaction;
int returnValue = 0;
_command.Parameters["@brkey"].Value = BRKEY;
_command.Parameters["@userkey"].Value = USERKEY;
_command.Parameters["@inspkey"].Value = INSPKEY;
try
{
if (_command.Connection.State == System.Data.ConnectionState.Closed)
_command.Connection.Open();
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.Message);
returnValue=-99;
}
if (returnValue !=0)
return(returnValue);
//frameTransaction = _command.Connection.BeginTransaction();
//_command.Transaction = frameTransaction;
try
{
_reader =_command.ExecuteReader();
_reader.Close();
returnValue = (int)_command.Parameters["@returnCode"].Value;
//frameTransaction.Commit();
_command.Connection.Close();
_command.Dispose();
}
catch (Exception exception)
{
//frameTransaction.Rollback();
System.Diagnostics.Trace.WriteLine(exception.Message);
returnValue=-99;
}
finally
{
if (_command != null)
_command.Dispose();
}
return(returnValue);
}
my parameters and my command and connection objects are created in the
initializer to my class
My users begin testing in 2 days and I'd like to have this
functionality working.
HELP! 8-)
.
- Follow-Ups:
- Re: StoredProc commits results in QueryAnalyzer but not in ADO.NET
- From: Cor Ligthert [MVP]
- Re: StoredProc commits results in QueryAnalyzer but not in ADO.NET
- From: Earl
- Re: StoredProc commits results in QueryAnalyzer but not in ADO.NET
- Prev by Date: CSV header conating "." dot and after loading it into dataset its converting into "#"
- Next by Date: Need some help on forms
- Previous by thread: CSV header conating "." dot and after loading it into dataset its converting into "#"
- Next by thread: Re: StoredProc commits results in QueryAnalyzer but not in ADO.NET
- Index(es):
Relevant Pages
|