Click here to Skip to main content
15,504,703 members

Comments by Teamsar Muliadi (Top 39 by date)

Teamsar Muliadi 8-Feb-11 2:09am View    
Deleted
Emmm.. Okay.. i will share about about my application as your information..
In my app i have 2 timers, Timer A and Timer B.
Periodically Timer A will check an signal like semaphore concept i think, if that signal is true or false. If true, a job like loading data from database (about 100 messages) will be processed until finished (signal = false).
These output will be inserted to table first, and then Timer B will do a job like sending ack messages to client per 1.5 seconds.
The main problem is, number of output (total ack) is not same with incoming in the output table whereas my application (console) doesn't processing it again (keep in mind that my app is still running, because of theses timers).
Teamsar Muliadi 12-Jan-11 2:39am View    
You can try this one :

public void DoInsertDataIncomingMsg(object sender)
{
OracleConnection objCon = new OracleConnection(CReaderConfig.StructureAppSettings.connStringAkses);
try
{
objCon.Open();
oTransc = objCon.BeginTransaction(IsolationLevel.Unspecified);
//oTransc.IsolationLevel = IsolationLevel.ReadCommitted;
oCommand = objCon.CreateCommand();
oCommand.Transaction = oTransc;
if (oCommand.Transaction == null)
{
log.Debug("Transaction 1 is null");
}
oCommand.CommandText = CQuery.Q_INSERT_INTO_T_INCOMING_MSGS(((CCommonStruct)sender).incoming_date,
((CCommonStruct)sender).membercode, ((CCommonStruct)sender).status_code,
((CCommonStruct)sender).getReferenceID);
oCommand.ExecuteScalar();

byte[] newvalue = System.Text.Encoding.Unicode.GetBytes(((CCommonStruct)sender).get_clob_messages);
log.Debug("New value : " + System.Text.Encoding.Unicode.GetString(newvalue));
log.Debug("Reference ID : " + ((CCommonStruct)sender).getReferenceID);

oCommand.CommandText = CQuery.Q_UPDATE_T_INCOMING_MSGS(((CCommonStruct)sender).getReferenceID);
if (oCommand.Transaction == null)
{
log.Debug("Transaction 2 is null");
}
using (OracleDataReader reader = oCommand.ExecuteReader())
{
reader.Read();
global::System.Data.OracleClient.OracleLob clob = reader.GetOracleLob(0);
clob.Write(newvalue, 0, newvalue.Length);
}
oTransc.Commit();
}
catch (Exception ex)
{
oTransc.Rollback();
log.Debug("Error while executing DoInsertDataIncomingMsg for Reference ID : " + ((CCommonStruct)sender).getReferenceID, ex);
}
finally
{
if (objCon != null)
{
objCon.Close();
oTransc.Dispose();
}
}
}
Teamsar Muliadi 8-Dec-10 4:24am View    
Mmm.. after i read the link (msdn) above, i have a question for you. How about destructor if we don't have constructor ?? Thanks :)
Teamsar Muliadi 8-Dec-10 4:19am View    
It means that if we want to implement IDisposable interface, the class(es) must have constructor, doesn't it ?
(after i read your links).
Teamsar Muliadi 26-Oct-10 0:58am View    
Hey... it works... :) thanks for giving me solution.. :)