how to run chain update command on dbase i'm using code below but performance is very slow. is there any way to update using sp's.
private static void UpdateRdTable(string rdTableName, List Data) { // Write to RD database
var oledbConnection = new OleDbConnection(OleDbConnectionString);
try
{
var date = DateTime.Today.ToString("MM/dd/yyyy");
var time = DateTime.Now.ToString("HH:mm:ss");
oledbConnection.Open();
foreach (var oledbcommand in Data
.Select(series => " UPDATE " + rdTableName + " SET " +
" CRNT_RDN = " + series.CRNT_RDN + "," +
" MON_CHARGE = " + series.MON_CHARGE + "," +
" CHRGD_AM = " + series.CHRGD_AM + "," +
" CONSUM = " + series.CONSUM + "," +
" RDNG_COD = '" + series.RDNG_COD + "'," +
" ERR_CODE = '" + series.ERR_CODE + "'," +
" SYSTEM_ID = 'DEO11'," +
" USER_ID = 'REV5', " +
" LOGIN_DATE = '" + date + "'," +
" LOGIN_TIME = '" + time + "' " +
" WHERE " +
" TRIM(MET_NUM) = '" + series.MET_NUM + "' AND " +
" ACCT_NUM = '"+ series.ACCT_NUM +"';")
.Select(commandText => new OleDbCommand(commandText, oledbConnection))){
oledbcommand.ExecuteNonQuery();
oledbcommand.Dispose();
}
oledbConnection.Close();
}
catch (Exception e)
{
oledbConnection.Close();
MessageBox.Show(@"Error : SqLiteExporter [428] " + e.Message);
}
}
thanks
Aucun commentaire:
Enregistrer un commentaire