Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Record Count Using OleDB?


Message #1 by "charles baldo" <charlesbaldo@h...> on Thu, 28 Jun 2001 16:16:26
Could Someone Please tell me how to do a record count using the oledb with 

access2000 database?



Thank You

Chuck 
Message #2 by "Albert Davis" <albertdavis@h...> on Thu, 28 Jun 2001 12:05:28 -0400
Charles,

I don't know if your using C# or not but I just had to convert my exsiting 

Beta1 code to Beta2 and here is some of my code that gets a record count 

using a SqlDataAdapter...  I pretty sure that you can use the 

OleDbDataAdapter in its place and it should work...  Tweak it a little bit 

and I think it should do what you need it to...



/****

C#

**/



using System.Data;

using System.Data.SqlClient;

//Try: using System.Data.OleDb; instead.



DataSet dataSet = new DataSet();



SqlConnection sqlConn = new SqlConnection(strConn);

//Try:  OleDbConnection class instead.



SqlDataAdapter sqlAdapter = new SqlDataAdapter();

//Try OleDbDataAdapter class instead.



sqlAdapter.SelectCommand = new SqlCommand(strSql, sqlConn);

sqlAdapter.Fill(dataSet);

DataTableCollection dataTblCollection = dataSet.Tables;



//Here is your RecordCount...

Console.Write(dataTblCollection[0].Rows.Count.ToString());



dataTblCollection = null;

sqlAdapter = null;

sqlConn = null;

dataSetAuth = null;





I hope this helps,

-- Al



>From: "charles baldo" <charlesbaldo@h...>

>Reply-To: "ASP+" <aspx@p...>

>To: "ASP+" <aspx@p...>

>Subject: [aspx] Record Count Using OleDB?

>Date: Thu, 28 Jun 2001 16:16:26

>

>Could Someone Please tell me how to do a record count using the oledb with

>access2000 database?

>

>Thank You

>Chuck




  Return to Index