473,406 Members | 2,404 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,406 software developers and data experts.

How to count records in database

Kosal
68
Dear All

Can you help me to do as below

I need to count record in database using VB.net 2005 in the table(id, product, quentity, unitprice, sName) and form interface had one textbox when i input supplier name into textbox and click button count it show number of supplier,

please help to give me the code for this.

thanks
Jul 23 '08 #1
7 1906
DrBunchman
979 Expert 512MB
Hi Kosal,

You don't say which database you use but you can use the COUNT function.

In SQL Server for example the syntax is:
Expand|Select|Wrap|Line Numbers
  1.  SELECT COUNT(*) FROM Table WHERE id = 123
Hope this helps,

Dr B
Jul 23 '08 #2
r035198x
13,262 8TB
When the button is clicked just do a select count(*) for the suppliers.
It does not have to (and should not) be linked with the entering of suppliers themselves.

Edit: Too late ...
Jul 23 '08 #3
Kosal
68
ok thanks

but i need to count supplier name not count id
Jul 23 '08 #4
DrBunchman
979 Expert 512MB
You can count whatever you like.
Expand|Select|Wrap|Line Numbers
  1. SELECT COUNT(*) WHERE .....
will return a count of all the records whose conditions satisfy your WHERE clause.

Dr B
Jul 23 '08 #5
r035198x
13,262 8TB
ok thanks

but i need to count supplier name not count id
Suppose there are only two suppliers in the table and they both have the same name, then should it show one or two?
Jul 23 '08 #6
Kosal
68
Hello sir
now it is ok
thank you for your help
Jul 23 '08 #7
rk4088
2
select count(sname) from table;
Jul 23 '08 #8

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

Similar topics

5
by: Arsen V. | last post by:
Hello, What is the best way to accomplish the following. 1) An ASP.NET program (consiting of one file somepage.aspx) receives about 25,000,000 requests pay day. 2) The requests come from a...
6
by: Kulwinder Sayal | last post by:
Hi In ASP it was so simple to get the no. of records using RecordCount. Can anyone help me how to write the no. of records my sqlquery has searched Thanks Kulwinder
2
by: Charlie | last post by:
Hi: When returning an SqlDataReader from a database query, how do you get a count of the number of records contained in the reader? There is no "Count" property for reader object. Thanks,...
4
by: Peter W Johnson | last post by:
Hi guys, I have a problem with a datagrid record count. Here is the code:- <snip> Public Class frmMerchantDeposit Inherits System.Windows.Forms.Form Dim myconnection As New...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
9
by: MLH | last post by:
A mailing list table in its virgin state contained sequential, consecutive integers in an autonumber field (A97). I've deleted records throughout the table. Now I would like to identify each...
1
by: danibecr | last post by:
I'm trying to make a table that will daily count the records imported and save them to a seperate table along with the date imported. But as of now after all the processing is complete I delete...
1
by: sparks | last post by:
I have always just got a count on records and put up a box at the top of the entry forms saying something like 1 of 500 and updating it as you got to 500 of 500. I have never thought of this as...
2
by: mfaisalwarraich | last post by:
Hi Everybody, I am using the following code to get the recordset of an external database. Dim dbPatients As Database Dim rsCountPatients As Recordset ' to count number of...
12
by: petter | last post by:
Hi! I have two questions: one question that regards the COUNT-function, and one about how to display a month even if I don’t have any data for that month. I have an Access database where I want...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.