473,756 Members | 3,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Counting number of records

8 New Member
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).Actuall y 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.T oShortDateStrin g
eDate = dtEnd.Value.ToS hortDateString

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 OleDbDataAdapte r(sqlCount, c)
adpLogCount.Fil l(dsLogCount, "LogCountTable" )
If dsLogCount.Tabl es("LogCountTab le").Rows.Cou nt > 0 Then
Dim logCountRow As DataRow
logCountRow =dsLogCount.Tab les("LogCountTa ble").Rows(0)
Dim countNo As Integer = logCountRow.Ite m("CountRow")
MsgBox (countNo) => result= 0
End If
Catch ex As Exception
MsgBox(ex.ToStr ing)
End Try
Log.Terminate()
Nov 20 '06 #1
0 1229

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

Similar topics

2
3847
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 could resolve with a simple function: Example: I have 50records - I want to update a selection of the recods - some,
7
1258
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
2087
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 how many Wins or Loses and Individual has in a match.. I'm not having a problem getting the reports and the grouping it by person but I'm having a problem with the logic of counting and display number of Wins and number of Loses. Is there...
5
1823
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 as pass or fails dependent on a batch number.
5
3507
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 go back to 1 and start counting up again until the next contract change. For example Contract 1111111 Box 1 of 2 Number Value: 1
18
2943
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 employee knows anything about Access. I've searched Google Groups, and that has been a lot of help, but there are some questions that I just can't find the answer to. I'll try to take it easy on the group after this question. I have one more...
9
2986
by: GeRmIc | last post by:
Hi, I receive an XML string like <record> <value>...</value> </record> <record> <value>...</value> </record>....... etc.,
8
1708
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 services received. The units cannot be less than the visits, you get a least one unit per visit. Here's the problem: If a visit is wrongly coded, then a reverse entry is made as follows. PTID CODE UNITS 1 100 ...
8
7120
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 each table and display how many of each there are, and the total, by year: 2008 A B A+B 2007 A B A+B 2006 A B A+B Right now I have a counting query for each of the tables, separately, but I can’t figure out how to properly join...
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9843
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.