Friday, 15 May 2015

c# - Counting data in ACCESS database? -



c# - Counting data in ACCESS database? -

i have 3 records in database (database type : microsoft access ) . personal info of 3 customers.

now in interface have button in name of "count customers" . when force want count records , says how many record(s) have in database ! . exmple here have 3 , must have 3 records or 3 cutomers .

i utilize visual studio 2008 , language c# . database microsoft access database .

using (oledbconnection con = new oledbconnection("provider=microsoft.jet.oledb.4.0; info source=c:\\test.mdb")) using (oledbcommand command = new oledbcommand(" select count (customerid) client total", con)) { con.open(); oledbdatareader db_reader = command.executereader(); if (db_reader.hasrows) { db_reader.read(); int id = db_reader.getint32(0); } }

c# database records counting

No comments:

Post a Comment