StoredProc commits results in QueryAnalyzer but not in ADO.NET

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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-)

.



Relevant Pages

  • Re: How to handle concurrency issue with better performance?
    ... Would you put the timestamp check in the stored procedure on the server ... that have been modified since they were pulled from the database. ... select command). ... client) downgrade very much in using such ...
    (microsoft.public.dotnet.framework.adonet)
  • Session_End event, System.NullReferenceException
    ... database table that is used to log user sessions. ... The stored procedure executes successfully, and I can see the updated data in ... an exception is being generated by the code that I'ved added to ... through an execution of the code that led to the exception. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to handle concurrency issue with better performance?
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... that have been modified since they were pulled from the database. ... select command). ... I create stored procedure for the update command and assign ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Extended Stored Procedure: Get the current db of the client
    ... with the caveat that you don't recommend it because Microsoft ... of a stored procedure versus umpteen of the same stored procedure spread ... I am not going after Gert Sue. ... the database context as a parameter if you need it, ...
    (microsoft.public.sqlserver.odbc)
  • Trying to set up a SQL Server Agent Account and I hit a wall....
    ... Our database is on SQL Server 2005, however it is set to compatibility mode ... You may need to set the compatibility level ... of the current database to a higher value to enable this feature. ... for the stored procedure sp_dbcmptlevel. ...
    (microsoft.public.sqlserver.security)