Private Sub SumSaleDay1()
Dim dt As New DataTable
Dim ds As New DataSet
Dim strSQL, strSQL1, strqr As String
Dim icount As Double
Dim strConn As String = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\akasit\Desktop\New.mdb"
Dim ConnDB As OleDb.OleDbConnection = New OleDb.OleDbConnection(strConn)
ConnDB.Open()
icount = 0
strSQL = "SELECT * FROM ReportSL"
adp = New OleDbDataAdapter(strSQL, ConnDB)
adp.Fill(ds)
dt = ds.Tables(0)
If dt.Rows.Count >= 0 Then
For i As Byte = 0 To dt.Rows.Count - 1
strsqr = "SELECT sum (TRD_B_SELL) FROM Newdata WHERE SLMN_CODE like '" & dt.Rows(i)("IdEmp") & "' and DI_DATE Like '" & Me.Label1.Text & "' and DT_PROPERTIES Like '307' and AR_CODE Not Like 'E1C0014017' and TRD_SH_CODE Like '885*'"
'Command = New OleDbCommand(strsqr, ConnDB)
Command = New System.Data.OleDb.OleDbCommand(strsqr, ConnDB)
Try
Me.Label8.Text = Command.ExecuteScalar(strsqr)
'icount.ToString("n2")
'Me.Label8.Text = icount
Catch ex As Exception
Label8.Text = "0"
End Try
strqr = "UPDATE ReportSL SET SaleDay = '" & Me.Label8.Text & "' WHERE IdEmp = '" & dt.Rows(i)("IdEmp") & "' "
Command = New OleDbCommand(strqr, ConnDB)
Command.ExecuteNonQuery()
Next
End If
ConnDB.Close()
End Sub