wampserver not responding
Posted by: wampAhmed (61.245.171.---)
Date: May 10, 2018 04:10AM

Hi, I am Ahmed,
I am using wampserver 2.0 with other default components(php, mysql, etc) in windows 7 32 bit machine. Whe I connecting to wampserver through an offline desktop application it works fine. But when i running a query via another form in same application, it takes huge time to execute. Sometimes not responding. Is there any way to solve this ?

targeting table contains 42 fields with 300,000 of records

followings are the statements.


 For n = 0 To size
            accCode = Me.ListBox1.Items(n)  ' available account codes is in listbox
            Me.dgvData.Rows.Add()
            m = m + 1
            Me.dgvData.Rows(m).Cells(1).Value = accCode + "_" + fun.accountName(accCode)  
            For j = 1 To 12
                If j < 10 Then
                    fromDate = Me.dtpAMonth.Text + "-0" + j.ToString + "-" + "01 00:00:00"
                    toDate = Me.dtpAMonth.Text + "-0" + j.ToString + "-" + Date.DaysInMonth(Me.dtpAMonth.Text, j).ToString + " 23:59:59"
                Else
                    fromDate = Me.dtpAMonth.Text + "-" + j.ToString + "-" + "01 00:00:00"
                    toDate = Me.dtpAMonth.Text + "-" + j.ToString + "-" + Date.DaysInMonth(Me.dtpAMonth.Text, j).ToString + " 23:59:59"
                End If
                'Me.dgvData.Rows(m).Cells(j + 1).Value = debitSumOfAnAccount(accCode, fromDate, toDate) - creditSumOfAnAccount(accCode, fromDate, toDate)
                Me.dgvData.Rows(m).Cells(j + 1).Value = fun.sumOfAnDebitAccountInAPeriod(accCode, fromDate, toDate)
                GC.Collect()
                Me.Refresh()
            Next
        Next 

function of "sumOfAnDebitAccountInAPeriod"

Dim SQLStatement As String = "SELECT debitorcredit, amount FROM account_accountsbalance_tb WHERE accountcode = '" + accCode + "' AND dateandtime BETWEEN '" + fromDate + "' AND '" + fromTo + "'"
        Dim tempDebitOrCredit As String = ""
        Dim tempTotal As Double = 0.0
        Dim SQLConnection As MySqlConnection = New MySqlConnection
        Dim cmd As MySqlCommand = New MySqlCommand
        Dim rdr As MySqlDataReader
        Try
            SQLConnection.ConnectionString = ServerString
            SQLConnection.Open()
            cmd.CommandText = SQLStatement
            cmd.CommandType = CommandType.Text
            cmd.Connection = SQLConnection
            cmd.ExecuteNonQuery()
            rdr = cmd.ExecuteReader()
            While (rdr.Read())
                tempDebitOrCredit = rdr("debitorcredit"winking smiley
                If tempDebitOrCredit = "Debit" Then
                    tempTotal = tempTotal + Double.Parse(rdr("amount"winking smiley)
                ElseIf tempDebitOrCredit = "Credit" Then
                    tempTotal = tempTotal - Double.Parse(rdr("amount"winking smiley)
                End If
            End While
            rdr.Close()
        Catch ex As Exception
            toLogFile("", "sumOfAnDebitAccountInAPeriod-Exception", Now.ToString("yyyy-MM-dd HH:mm:ss"winking smiley)
            recordExceptionalError("sumOfAnDebitAccountInAPeriod(Function) - Account_ProfitAndLossStatment", ex.Message.ToString, Now.ToString("yyyy-MM-dd HH:mm:ss"winking smiley)
            MessageBox.Show(ex.Message + " Error while calculating sum of an debit account.", "ABC MAS 1.5", MessageBoxButtons.OK, MessageBoxIcon.Error)
        Finally
            SQLConnection.Close()
            SQLConnection.Dispose()
            cmd.Dispose()
            GC.Collect()
        End Try
        Return tempTotal



Edited 1 time(s). Last edit at 05/10/2018 11:13AM by RiggsFolly.

Options: ReplyQuote
Re: wampserver not responding
Posted by: Otomatic (Moderator)
Date: May 10, 2018 09:19AM

Hi,

> I am using wampserver 2.0
Totally obsolete and no longer supported for ages.

On the other hand, this forum is not intended to correct PHP scripts and MySQL queries.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: wampserver not responding
Posted by: wampAhmed (112.134.37.---)
Date: May 10, 2018 09:34AM

Hi Otomatic,
I would like mension that codes are free of errors. Only about the wampserver.
Thank you for your reply.

Options: ReplyQuote
Re: wampserver not responding
Posted by: Otomatic (Moderator)
Date: May 10, 2018 11:05AM

Hi,

[dev.mysql.com]

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: wampserver not responding
Posted by: wampAhmed (61.245.169.---)
Date: May 11, 2018 03:05AM

Hi,
Thank you Otomatic,
"Totally obsolete and no longer supported for ages."
I shifted to "Wampserver32".
Problem fixed.

Options: ReplyQuote


Sorry, only registered users may post in this forum.