Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Get record count from filtered datasourse (not set)

Reply
Thread Tools

Get record count from filtered datasourse (not set)

 
 
=?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=
Guest
Posts: n/a
 
      07-06-2007
What are the steps necessary to get the filtered count from datasource. If i
have to move it into a table just to gat the count i'll do so, but i'm not
sure what the steps are needed to accomplish this.

Thanks
KES
--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes
 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      07-06-2007
"WebBuilder451" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> What are the steps necessary to get the filtered count from datasource. If
> i
> have to move it into a table just to gat the count i'll do so, but i'm not
> sure what the steps are needed to accomplish this.


DataSet MyDS = <fetch DataSet>;
MyDS.Tables[0].DefaultView.RowFilter = "......";
int FilterCount = MyDS.Tables[0].DefaultView.Count;


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
 
 
 
=?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?=
Guest
Posts: n/a
 
      07-06-2007
thanks for replying,
I did see this (your answer specific) in another of your postings and it is
what prompted me to repost with the "(not set)". My admitted lack of
knowledge here is how to get my dataSOURCE in to the dataSET. (...<fetch
DataSet>

--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes


"Mark Rae [MVP]" wrote:

> "WebBuilder451" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
> > What are the steps necessary to get the filtered count from datasource. If
> > i
> > have to move it into a table just to gat the count i'll do so, but i'm not
> > sure what the steps are needed to accomplish this.

>
> DataSet MyDS = <fetch DataSet>;
> MyDS.Tables[0].DefaultView.RowFilter = "......";
> int FilterCount = MyDS.Tables[0].DefaultView.Count;
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
>
>

 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      07-06-2007
"WebBuilder451" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> thanks for replying,
> I did see this (your answer specific) in another of your postings and it
> is
> what prompted me to repost with the "(not set)". My admitted lack of
> knowledge here is how to get my dataSOURCE in to the dataSET. (...<fetch
> DataSet>


You need to know how to create a DataSet?

Firstly, it makes a (slight) difference what RDBMS you're using but, for the
sake of argument, let's say you're using SQL Server...

You'll need to reference the System.Data namespace, and use an appropriate
connection string, something like this:

Data Source=myServerAddress;Initial Catalog=myDataBase;User
Id=myUsername;Password=myPassword;

For more specific examples, see here:
http://www.connectionstrings.com/?carrier=sqlserver2005

string strConnectionString = "<...connection string - see above...>";

using (SqlConnection objSqlConnection = new
SqlConnection(strConnectionString))
{
objSqlConnection.Open();
using (SqlCommand objSqlCommand = new SqlCommand(pstrSQL,
objSqlConnection))
{
using (SqlDataAdapter objDA = new SqlDataAdapter(objSqlCommand))
{
using (DataSet objDataSet = new DataSet())
{
objDA.Fill(objDataSet);
objSqlConnection.Close();
return (objDataSet);
}
}
}
}


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting a record count for a filtered datasource Greg Smith ASP .Net 1 05-31-2007 01:25 PM
datasourse ohood Java 1 04-03-2007 10:05 PM
gridview without using any datasourse control rockeydon@rediff.com ASP .Net Web Controls 0 01-17-2007 07:49 AM
datasourse 2.0 question =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= ASP .Net 0 05-10-2006 12:58 PM
Binding controls with datasourse =?Utf-8?B?Um9ieSBFaXNlbmJyYXVuIE1hcnRpbnM=?= ASP .Net 1 12-12-2005 04:22 PM



Advertisments