Count Rcords

  • Thread starter Thread starter Anuradha
  • Start date Start date
By reading the records and count them. As a datareader is specialized
for reading a result from start to end, there is no way of getting the
number of records in the result without reading them.

If you only want to know the number of records, you should use a count()
expression in the SQL query instead. That way you only get the
information you need in the result instead of a lot of data that you
don't use.
 
In addition to Göran's post, you can use the ExecuteScalar method of the
DataCommand to retrieve the count.
 
What i mean is I need to check the table and if records found I need to
update another table. I will give a example



Select * from bktrn where EPF='" & text.text & "'



If recodes found then

xxxxxxxxx

end if



how can I do this


Thx
Anuradha
 
As I said, use a count() expression in the query:

Select count(*) from bktrn where EPF='" & text.text & "'

The query will return a single record with a single field, that contains
the number of records that matched the condition.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Data Reader 2
Run on another Computer 1
Send Mail 7
Send Email 1
shockwaveFlash 1
Send Mails 1
Db2 Conection 1
Access Dcount function in access 0

Back
Top