ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل مستخدم محذوف‎
تاريخ النشر: 2013/08/02
OMAR ABDULWAHAB
من قبل 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
من قبل 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

المزيد من الأسئلة المماثلة