473,320 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Counting number of records

Hello…
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…

Carol,

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

Dim dsLogCount As DataSet = New DataSet
Log.Initialize(c)
Try
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
MsgBox(ex.ToString)
End Try
Log.Terminate()
Nov 20 '06 #1
0 1210

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

Similar topics

2
by: Reply via newsgroup | last post by:
Folks, When performing an update in mysql (using PHP), can I find out how many records were matched? mysql_affected_rows() won't work... and I have the following problem that I thought I...
7
by: C White | last post by:
A little while back I had a question about counting records and my example was something like this: in my database table i have the following records john ed john rick tom
2
by: N. Graves | last post by:
I have a table with records of games played with a field for players name and another fields is a "WinorLose". One player may play several games to complete a match. I want my report to tell me...
5
by: chrisc | last post by:
Hello, Hope this is the right place for this... I am creating a testing database for components as they come off a production line. My reports need to select faults that are found, as well...
5
by: ChadDiesel | last post by:
Hello Again, I want to assign a number to each record that will be part of a shipping number. I want the number value to count up until the contract number changes. Then, I want the number to...
18
by: ChadDiesel | last post by:
I appreciate the help on this group. I know I've posted a lot here the last couple of weeks, but I was thrown into a database project at my work with very little Access experience. No other...
9
by: GeRmIc | last post by:
Hi, I receive an XML string like <record> <value>...</value> </record> <record> <value>...</value> </record>....... etc.,
8
by: johnds | last post by:
This is my third question about eliminating accounting entries in a clinical database, yet retaining the valid record. Latest wrinkle is being able to sum the visits to the doctor, and the units of...
8
by: crassostrea | last post by:
Hello and Happy New Year, I have two tables in Access 2003 (Windows XP) with similar, but different, information. We’ll call them table A and table B. I want to count the number of records in...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.