Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

Am moving from VB6 to VB.net, I have a real problem to get the number of records in ADO.net, any help?

I used to use RecordSet.RecordCount property to get it. Any help ^_^ ???

user-image
Question ajoutée par Utilisateur supprimé
Date de publication: 2013/08/02
OMAR ABDULWAHAB
par OMAR ABDULWAHAB , programmer , knone

example: Dim con As New OledDB.OleDBConnection con.connectionstring = "xxxxxxx" dim ds as new dataset dim da as oledb.oledbdataadepter dim sql as string sql = "SELECT * From xxx" da = new oledb.oledbdataadepter(sql,con) da.fill (ds,"xx") con.close() maxrows = ds.tables("cntct").rows.count

Daanish Rumani
par Daanish Rumani , Product Manager , Publicis Sapient

You can use the DataSet class and its Fill() method if you want to get all the records as well as their count.
If all you need is the count then better fire a query that call the Count() SQL aggregate method.
Code samples on how to use the DataSet: http://support.microsoft.com/kb/315974 http://www.c-sharpcorner.com/UploadFile/mahesh/ADORecSetFromADONetAM/ADORecSetFromADONet.aspx

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?