I have a winform application and im using sql local db but i see a slow performance on loading records from database and when laptop on standby mode and i start using application i see the database close and very very slow to load data and im using this code to load data
Sub loadcart()
Dim _total As Double
Dim _stotal As Double
DataGridView1.Rows.Clear()
cn.Open()
cm = New SqlCommand("Select c.id, p.description, c.price, c.qty, c.total,c.sprice, c.stotal from tblcart as c inner join tblproduct as p on p.id = c.pid Where c.transno like '" & LblTransNo.Text & "' ", cn)
dr = cm.ExecuteReader
While dr.Read
_total += CDbl(dr.Item("total").ToString)
_stotal += CDbl(dr.Item("stotal").ToString)
DataGridView1.Rows.Add(dr.Item("id").ToString, dr.Item("description").ToString, dr.Item("price").ToString, dr.Item("qty").ToString, dr.Item("total").ToString, dr.Item("sprice").ToString, dr.Item("stotal").ToString)
End While
dr.Close()
cn.Close()
LblTotal.Text = Format(_total, "#,##0.00")
LblSTotal.Text = Format(_stotal, "#,##0.00")
'LblTotal.Text = Format(_total, "#,##0.00") & " DA"
If DataGridView1.Rows.Count < 1 Then
BtnSettle.Enabled = False
'BtnCancel.Enabled = False
Else
BtnSettle.Enabled = True
'BtnCancel.Enabled = True
End If
End Sub