Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread EDBException - TEDBTableFileBuffer
Tue, Jul 7 2009 7:24 AMPermanent Link

Dar
Hi,
I have two threads inserting data into the same table every second. The threads run in
background on 2 seperate MDI forms (2 instances of the same object). After a while I get
the exception identified below. It can occur on either thread. I've included code at the
bottom as well. Would anyoen have any idea as to what  might be causing this?

Thanks a million,
Dar..

Elevate.ElevateDB.Data.EDBException: Object reference not set to an instance of an object.
---> System.NullReferenceException: Object reference not set to an instance of an object.
  at Elevate.ElevateDB.Data.Engine.TEDBTableFileBuffer.get_RawStream()
  at Elevate.ElevateDB.Data.Engine.TEDBRowsetRowValues.SetRow(TEDBRowsetRow Value)
  at Elevate.ElevateDB.Data.Engine.TEDBRowsetRowValues.set_Row(TEDBRowsetRow Value)
  at Elevate.ElevateDB.Data.Engine.TEDBRowsetNavigator.First(Boolean& FoundChanges)
  at Elevate.ElevateDB.Data.Engine.TEDBCursorRowsetNavigator.First(Boolean& FoundChanges)
  at Elevate.ElevateDB.Data.Engine.TEDBLocalCursor.First()
  at Elevate.ElevateDB.Data.Engine.TEDBCursorValue.Open()
  at Elevate.ElevateDB.Data.Engine.TEDBLocalEvaluator.EvaluateTableRef(TEDBExprToken Token)
  at Elevate.ElevateDB.Data.Engine.TEDBExprEvaluator.EvaluateNextToken(TEDBExprToken Token)
  at Elevate.ElevateDB.Data.Engine.TEDBExprEvaluator.Evaluate(TEDBExprToken Token)
  at Elevate.ElevateDB.Data.Engine.TEDBInsertManager.Prepare()
  at Elevate.ElevateDB.Data.Engine.TEDBLocalStatementManager.Prepare(String
StatementToPrepare)
  at Elevate.ElevateDB.Data.Engine.TEDBLocalDatabaseManager.PrepareStatement(String
StatementToPrepare, Int32 StartLine, Int32 StartColumn)
  at Elevate.ElevateDB.Data.Engine.TEDBLocalDatabaseManager.PrepareStatement(String
StatementToPrepare)
  at Elevate.ElevateDB.Data.EDBCommand.Prepare()
  --- End of inner exception stack trace ---
  at Elevate.ElevateDB.Data.EDBCommand.Prepare()
  at Elevate.ElevateDB.Data.EDBCommand.Execute()
  at Elevate.ElevateDB.Data.EDBCommand.ExecuteNonQuery()
  at ERPIx.WorkProcessStorageAccess.InsertWpStatistics(String SID, DateTime TakenOn,
ERPProcessList ProcessList) in C:\System\VS
Projects\2008\Tools4ERP\ERPProcess\Classes\WorkProcessStorageAccess.cs:line 208


Method:
======
public void InsertWpStatistics(string SID, DateTime TakenOn, EProcessList ProcessList)
{
           object _l = new object();
           string _insertstring = "insert into WpStats (TakenOn, Sys, D1, U1, U2, B1, E1,
S1) values (:timestamp, :sy, :d, :u, :u2, :b, :e, :s)";

           try
           {
               lock (_l)
               {
                   EDBCommand _cmd = new EDBCommand(_insertstring, _conn);
                   _cmd.Parameters["timestamp"].Value = TakenOn;
                   _cmd.Parameters["sy"].Value = SID;
                   _cmd.Parameters["d"].Value = ProcessList.PercentageBusyD;
                   _cmd.Parameters["u"].Value = ProcessList.PercentageBusyU;
                   _cmd.Parameters["u2"].Value = ProcessList.PercentageBusyU2;
                   _cmd.Parameters["b"].Value = ProcessList.PercentageBusyB;
                   _cmd.Parameters["e"].Value = ProcessList.PercentageBusyE;
                   _cmd.Parameters["s"].Value = ProcessList.PercentageBusyS;

                   _cmd.ExecuteNonQuery();
                   _cmd.Dispose();
               }
           }
           catch (Exception)
           {
               throw;
           }
}
Tue, Jul 7 2009 1:12 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Dar,

<<I have two threads inserting data into the same table every second. The
threads run in background on 2 seperate MDI forms (2 instances of the same
object). After a while I get the exception identified below. It can occur on
either thread. I've included code at the bottom as well. Would anyoen have
any idea as to what  might be causing this? >>

Are you using a separate EDBConnection and EDBCommand object instance for
each thread ?  EDB requires that each thread have its own connection.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Jul 8 2009 4:56 AMPermanent Link

Dar
Thanks for your reply Tim,
Indeed, I am establishing a new connection each time I instantiate the object. I might
mention that before I call the method I mentioned earlier I'm also calling this
immediately before it:

public void InsertProcessListE(string Sys, DateTime TakenOn, DataSet WorkProcess)
{
           string _insert = "insert into Snapshot (TakenOn, Sys, Compressed, ProcessRaw)
values (:timestamp, :Sys, :compressed, Tongueocessraw)";

           object _l = new object();
           try
           {
               lock (_l)
               {
                   EDBCommand _cmd = new EDBCommand(_insert, _conn);
                   _cmd.Parameters["Sys"].Value = Sys;
                   _cmd.Parameters["timestamp"].Value = TakenOn;
                   if (_erpsettings.UserCompression)
                   {
                       _cmd.Parameters["processraw"].Value =
Serializer.ToByteArrayCompressed(WorkProcess);
                       _cmd.Parameters["compressed"].Value = "y";
                   }
                   else
                   {
                       _cmd.Parameters["processraw"].Value =
Serializer.ToByteArray(WorkProcess);
                       _cmd.Parameters["compressed"].Value = "n";
                   }
                   _cmd.ExecuteNonQuery();
                   _cmd.Dispose();
               }
           }
           catch (Exception)
           {
               throw;
           }
}

The calling code is :
try
{
      _sa.InsertProcessListE(_sys, _eprocesslist.Timestamp,
_eprocesslist.WorkProcessDataSet);
      //Thread.Sleep(100);
      _sa.InsertWpStatistics(_sys, _eprocesslist.Timestamp, _eprocesslist);
}
catch (Exception)
{
       throw;
}
Wed, Jul 8 2009 2:18 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Dar,

<< Thanks for your reply Tim,
Indeed, I am establishing a new connection each time I instantiate the
object. >>

In that case please send me an example project (support@elevatesoft.com)
that reproduces what you're seeing.  I'll check it out and see what I can
find.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Jul 15 2009 10:20 AMPermanent Link

Dar
Hi Tim,
I'm trying to send you a zip file with the example project in it, but the mail is bouncing back from support@elevatesoft.com indicating the error :
'Transaction failed - unsolicited attachments' (delivery attempts: 0)

Is there another address I can try?

Thanks Tim,
Dar..
Thu, Jul 16 2009 2:18 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Dar,

<< I'm trying to send you a zip file with the example project in it, but the
mail is bouncing back from support@elevatesoft.com indicating the error :
'Transaction failed - unsolicited attachments' (delivery attempts: 0)

Is there another address I can try? >>

Send me an email without the attachments (timyoung@elevatesoft.com).   That
will give me your email address so that I can add you to our white list, and
then you'll be able to send the email with the attachment.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image