Click here to Skip to main content
15,917,618 members
Home / Discussions / Windows Forms
   

Windows Forms

 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari15-Dec-08 19:01
Uma Kameswari15-Dec-08 19:01 
GeneralRe: How to Improve the performance of a database application Pin
Dave Kreskowiak15-Dec-08 19:16
mveDave Kreskowiak15-Dec-08 19:16 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari15-Dec-08 19:19
Uma Kameswari15-Dec-08 19:19 
GeneralRe: How to Improve the performance of a database application Pin
Dave Kreskowiak15-Dec-08 20:04
mveDave Kreskowiak15-Dec-08 20:04 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari15-Dec-08 20:54
Uma Kameswari15-Dec-08 20:54 
GeneralRe: How to Improve the performance of a database application Pin
Wendelius16-Dec-08 7:09
mentorWendelius16-Dec-08 7:09 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari16-Dec-08 20:57
Uma Kameswari16-Dec-08 20:57 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari21-Dec-08 23:13
Uma Kameswari21-Dec-08 23:13 
Hi Mika Wendelius,
The alternate update statements given by you helped me a lot in speeding up the process. I have few more areas where I need to re-design the logic. I am giving the code below. Please suggest alternative for this. roughly the loop is going to run for 100,000 to 300,000 rows.

for (int i = 0; i < ds.Tables["InGL"].Rows.Count; i++)
        {
            iJrnEntry = Convert.ToInt32(ds.Tables["InGL"].Rows[i]["JRNENTRY"]);
            dtTrxDate = Convert.ToDateTime(ds.Tables["InGL"].Rows[i]["trxdate"]);
            strTrxSorce = ds.Tables["InGL"].Rows[i]["trxsorce"].ToString();
            strActIndex = ds.Tables["InGL"].Rows[i]["account"].ToString();
            strGLUser = ds.Tables["InGL"].Rows[i]["USWHPSTD"].ToString();
            strOrgnTrxSorce = ds.Tables["InGL"].Rows[i]["orgntsrc"].ToString();
            strOrgnDocNo = ds.Tables["InGL"].Rows[i]["orctrnum"].ToString();
            strOrTrxSrc = ds.Tables["InGL"].Rows[i]["ortrxsrc"].ToString();
            dclGLDr = Convert.ToDecimal(ds.Tables["InGL"].Rows[i]["debitamt"]);
            dclGLCr = Convert.ToDecimal(ds.Tables["InGL"].Rows[i]["crdtamnt"]);
            dexrowid = Convert.ToInt32(ds.Tables["InGL"].Rows[i]["Dex_row_id"]);
            iGLACT = Convert.ToInt32(ds.Tables["InGL"].Rows[i]["actindx"]);
            iGlSeqNo = Convert.ToInt32(ds.Tables["InGL"].Rows[i]["origseqnum"]);
            strOrgnDocNo = strOrgnDocNo.Replace("'", "''");
            strSource = strOrgnTrxSorce.Trim();
            if (strOrgnTrxSorce.Trim() == "")
                strSource = strOrTrxSrc;
            cmd.CommandText = "select count(*) from gl_sl_cmpr where sopno='" + strOrgnDocNo + "' and actindex ='" + strActIndex + "' and trxsorce='" + strSource + "'";
            cmd.ExecuteNonQuery();
            if (ds.Tables.Contains("matchcount"))
                ds.Tables.Remove("matchcount");
            da.Fill(ds, "matchcount");


            reccnt = Convert.ToInt32(ds.Tables["matchcount"].Rows[0][0]);

            if (reccnt == 0)
            {
                cmd.CommandText = " insert into gl_sl_cmpr(jrnentry,gltrxdate,SOURCE,GLACTINDEX,USWHPSTD,ORTRXSRC,ORGCTRNUM,GLDR,GLCR,gldexrowid,glact,status) values (" + iJrnEntry + ",COnvert(datetime,'" + dtTrxDate.ToShortDateString() + "',103),'" + strTrxSorce + "','" + strActIndex + "','" + strGLUser + "','" + strOrgnTrxSorce + "','" + strOrgnDocNo + "'," + dclGLDr + "," + dclGLCr + "," + dexrowid + "," + iGLACT + ",2)";
                cmd.ExecuteNonQuery();
            }
            else if (reccnt == 1)
            {
                cmd.CommandText = "update gl_sl_cmpr set JRNENTRY= " + iJrnEntry + ",GLTRXDATE=COnvert(datetime,'" + dtTrxDate.ToShortDateString() + "',103),SOURCE='" + strTrxSorce + "',GLACTINDEX='" + strActIndex + "',USWHPSTD='" + strGLUser + "',ORTRXSRC='" + strOrgnTrxSorce + "',ORGCTRNUM='" + strOrgnDocNo + "',GLDR=" + dclGLDr + ",GLCR =" + dclGLCr + ",gldexrowid=" + dexrowid + " ,glact = " + iGLACT + ", status = 1 where sopno='" + strOrgnDocNo + "' and actindex ='" + strActIndex + "' and trxsorce='" + strSource + "'";
                cmd.ExecuteNonQuery();
            }
            else
            {
                cmd.CommandText = "insert into gl_sl_cmpr(jrnentry,gltrxdate,SOURCE,GLACTINDEX,USWHPSTD,ORTRXSRC,ORGCTRNUM,GLDR,GLCR,gldexrowid,glact,status) values (" + iJrnEntry + ",COnvert(datetime,'" + dtTrxDate.ToShortDateString() + "',103),'" + strTrxSorce + "','" + strActIndex + "','" + strGLUser + "','" + strOrgnTrxSorce + "','" + strOrgnDocNo + "'," + dclGLDr + "," + dclGLCr + "," + dexrowid + "," + iGLACT + ",7)";
                cmd.CommandText += " update gl_sl_cmpr set status = 7 where sopno='" + strOrgnDocNo + "' and actindex ='" + strActIndex + "' and trxsorce='" + strSource + "'";
                cmd.ExecuteNonQuery();
            }

            iCount++;
        }

This logic is taking very long time and I have to modify it. Please let me know if anything can be done to improve.
THanks in advance.
GeneralRe: How to Improve the performance of a database application Pin
Wendelius22-Dec-08 9:36
mentorWendelius22-Dec-08 9:36 
GeneralRe: How to Improve the performance of a database application [modified] Pin
Uma Kameswari22-Dec-08 18:38
Uma Kameswari22-Dec-08 18:38 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari23-Dec-08 0:04
Uma Kameswari23-Dec-08 0:04 
GeneralRe: How to Improve the performance of a database application Pin
Wendelius23-Dec-08 3:23
mentorWendelius23-Dec-08 3:23 
GeneralRe: How to Improve the performance of a database application Pin
Uma Kameswari23-Dec-08 18:05
Uma Kameswari23-Dec-08 18:05 
GeneralRe: How to Improve the performance of a database application Pin
Wendelius28-Dec-08 10:35
mentorWendelius28-Dec-08 10:35 
QuestionVisual studio addin Pin
Fadi Yoosuf14-Dec-08 16:11
Fadi Yoosuf14-Dec-08 16:11 
AnswerRe: Visual studio addin Pin
Lev Danielyan15-Dec-08 19:55
Lev Danielyan15-Dec-08 19:55 
QuestionArrayList Problem Pin
bapu288912-Dec-08 8:31
bapu288912-Dec-08 8:31 
QuestionNot able to retain DataGridViewComboBox Cell's selected item value Pin
Member 62119111-Dec-08 18:38
Member 62119111-Dec-08 18:38 
QuestionSimple custom control repaint problem Pin
TheRedEye10-Dec-08 22:05
TheRedEye10-Dec-08 22:05 
AnswerRe: Simple custom control repaint problem Pin
Dave Kreskowiak11-Dec-08 2:04
mveDave Kreskowiak11-Dec-08 2:04 
GeneralRe: Simple custom control repaint problem Pin
TheRedEye11-Dec-08 4:05
TheRedEye11-Dec-08 4:05 
GeneralRe: Simple custom control repaint problem Pin
Dave Kreskowiak11-Dec-08 4:42
mveDave Kreskowiak11-Dec-08 4:42 
Questionhow to change language dependent datetime picker dynamically in .net window forms Pin
arunmca.r10-Dec-08 21:43
arunmca.r10-Dec-08 21:43 
AnswerRe: how to change language dependent datetime picker dynamically in .net window forms Pin
Mycroft Holmes11-Dec-08 20:37
professionalMycroft Holmes11-Dec-08 20:37 
GeneralRe: how to change language dependent datetime picker dynamically in .net window forms Pin
arunmca.r14-Dec-08 17:31
arunmca.r14-Dec-08 17:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.