469,649 Members | 1,259 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,649 developers. It's quick & easy.

Counting number of records

I have problem when counting the number of records, which is based on the start date and end date.
I have tried to use message box to prompt the result, but the result given is zero(0).Actually there have records in database which fulfill the “WHERE” clause condition in sql statement.
Thanks for yours help…


/* Below is my code sample(VB.NET) */
sDate = dtStart.Value.ToShortDateString
eDate = dtEnd.Value.ToShortDateString

Dim dsLogCount As DataSet = New DataSet
Dim sqlCount As String = "SELECT COUNT (*) AS CountRow FROM LogFile WHERE LogDate BETWEEN " & sDate & " AND " & eDate & ""
Dim adpLogCount As New OleDbDataAdapter(sqlCount, c)
adpLogCount.Fill(dsLogCount, "LogCountTable")
If dsLogCount.Tables("LogCountTable").Rows.Count > 0 Then
Dim logCountRow As DataRow
logCountRow =dsLogCount.Tables("LogCountTable").Rows(0)
Dim countNo As Integer = logCountRow.Item("CountRow")
MsgBox (countNo) => result= 0
End If
Catch ex As Exception
End Try
Nov 20 '06 #1
0 1054

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Reply via newsgroup | last post: by
7 posts views Thread by C White | last post: by
2 posts views Thread by N. Graves | last post: by
18 posts views Thread by ChadDiesel | last post: by
8 posts views Thread by johnds | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.