PC Review


Reply
Thread Tools Rate Thread

DefaultView.Count always returns 1

 
 
Daniel Walzenbach
Guest
Posts: n/a
 
      27th Jul 2003
Hi,



I have the following scenario:



myDataSet.Tables("tblCustomer").Rows.Count = 4



This is quite fine as the table contains 4 rows. However



myDataSet.Tables("tblCustomer").DefaultView.Count = 1



is not exactly what I expected it to be (I thought the result should be 4). Can anybody explain this behavior to me?



Thanks in advance



Daniel


 
Reply With Quote
 
 
 
 
Carl Prothman [MVP]
Guest
Posts: n/a
 
      27th Jul 2003
Daniel,
I get the same count when using the following code:

' Note I create the sqlConnection1 and sqlDataAdapter1
' by dragging a Table from Server Explorer onto the WinForm.
Dim ds As DataSet = New DataSet
SqlDataAdapter1.Fill(ds, "customers")

MsgBox("Rows.Count = " & ds.Tables("customers").Rows.Count)
MsgBox("DefaultView.RowFilter = " & ds.Tables("customers").DefaultView.RowFilter)
MsgBox("DefaultView.RowStateFilter = " & ds.Tables("customers").DefaultView.RowStateFilter.ToString())
MsgBox("DefaultView.Count = " & ds.Tables("customers").DefaultView.Count)

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP
http://www.able-consulting.com


"Daniel Walzenbach" <(E-Mail Removed)> wrote in message news:ehhn#(E-Mail Removed)...
> Carl,
>
>
>
> I have checked those as well and they seem to be fine. However .RowFilter is
> set to "" (String.Empty) and .RowStateFilter ist set to "CurrentRows".
>
> I have also read on
> http://msdn.microsoft.com/library/de...us/cpref/html/
> frlrfsystemdatadatatableclassdefaultviewtopic.asp that the DefaultView
> Property is "a customized view of the table which may include a filtered
> view, or a cursor position." I assume it somehow returns a cursor position
> but I'm not sure why.
>
> Thanks
>
> Daniel
>
>
> "Carl Prothman [MVP]" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:(E-Mail Removed)...
> > Daniel,
> > What are the values for the following properties?
> > ds.Tables(0).DefaultView.RowFilter
> > ds.Tables(0).DefaultView.RowStateFilter
> >
> > --
> >
> > Thanks,
> > Carl Prothman
> > Microsoft ASP.NET MVP
> > http://www.able-consulting.com
> >
> >
> > "Daniel Walzenbach" <(E-Mail Removed)> wrote in

> message news:(E-Mail Removed)...
> > Hi,
> >
> > I have the following scenario:
> >
> > myDataSet.Tables("tblCustomer").Rows.Count = 4
> >
> > This is quite fine as the table contains 4 rows. However
> >
> > myDataSet.Tables("tblCustomer").DefaultView.Count = 1
> >
> > is not exactly what I expected it to be (I thought the result should be

> 4). Can anybody explain this behavior to me?
> >
> > Thanks in advance
> >
> > Daniel
> >
> >

>
>



 
Reply With Quote
 
Daniel Walzenbach
Guest
Posts: n/a
 
      27th Jul 2003
I'm going completely nuts. I have tried what you did and it works (don't
know if I should be :-) or :-(.). Now I have a form with nothing on it but
two stupid datagrids one bound to the dataset itself and the other one to
the dataview. My application on the other hand still doesn't work & I can't
see any mistake.



If anybody has ANY (really anything!!!) idea what my problem could be please
post it (Could it be a problem that my dataset was stored in a SessionID? Do
I loose any information doing so which I would need now?).



Thank you!



Daniel





"Daniel Walzenbach" <(E-Mail Removed)> schrieb im
Newsbeitrag news:(E-Mail Removed)...
> Carl,
>
>
>
> this is how I expected it should be but nevertheless I get different
> results. Do you know anything about the "cursor position" part in the
> definition of a DataView as it is written in the MSDN? It seems that I
> always get back a single cursor row but I don't know why and how to prove

my
> assumption?
>
>
>
> Thank you Carl for your help!! I appreciate your efforts.
>
>
>
> Daniel
>
>
> "Carl Prothman [MVP]" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:#2$(E-Mail Removed)...
> > Daniel,
> > I get the same count when using the following code:
> >
> > ' Note I create the sqlConnection1 and sqlDataAdapter1
> > ' by dragging a Table from Server Explorer onto the WinForm.
> > Dim ds As DataSet = New DataSet
> > SqlDataAdapter1.Fill(ds, "customers")
> >
> > MsgBox("Rows.Count = " & ds.Tables("customers").Rows.Count)
> > MsgBox("DefaultView.RowFilter = " &

> ds.Tables("customers").DefaultView.RowFilter)
> > MsgBox("DefaultView.RowStateFilter = " &

> ds.Tables("customers").DefaultView.RowStateFilter.ToString())
> > MsgBox("DefaultView.Count = " &

ds.Tables("customers").DefaultView.Count)
> >
> > --
> >
> > Thanks,
> > Carl Prothman
> > Microsoft ASP.NET MVP
> > http://www.able-consulting.com
> >
> >
> > "Daniel Walzenbach" <(E-Mail Removed)> wrote in

> message news:ehhn#(E-Mail Removed)...
> > > Carl,
> > >
> > >
> > >
> > > I have checked those as well and they seem to be fine. However

> .RowFilter is
> > > set to "" (String.Empty) and .RowStateFilter ist set to "CurrentRows".
> > >
> > > I have also read on
> > >

>

http://msdn.microsoft.com/library/de...us/cpref/html/
> > > frlrfsystemdatadatatableclassdefaultviewtopic.asp that the DefaultView
> > > Property is "a customized view of the table which may include a

filtered
> > > view, or a cursor position." I assume it somehow returns a cursor

> position
> > > but I'm not sure why.
> > >
> > > Thanks
> > >
> > > Daniel
> > >
> > >
> > > "Carl Prothman [MVP]" <(E-Mail Removed)> schrieb im Newsbeitrag
> > > news:(E-Mail Removed)...
> > > > Daniel,
> > > > What are the values for the following properties?
> > > > ds.Tables(0).DefaultView.RowFilter
> > > > ds.Tables(0).DefaultView.RowStateFilter
> > > >
> > > > --
> > > >
> > > > Thanks,
> > > > Carl Prothman
> > > > Microsoft ASP.NET MVP
> > > > http://www.able-consulting.com
> > > >
> > > >
> > > > "Daniel Walzenbach" <(E-Mail Removed)> wrote

in
> > > message news:(E-Mail Removed)...
> > > > Hi,
> > > >
> > > > I have the following scenario:
> > > >
> > > > myDataSet.Tables("tblCustomer").Rows.Count = 4
> > > >
> > > > This is quite fine as the table contains 4 rows. However
> > > >
> > > > myDataSet.Tables("tblCustomer").DefaultView.Count = 1
> > > >
> > > > is not exactly what I expected it to be (I thought the result should

> be
> > > 4). Can anybody explain this behavior to me?
> > > >
> > > > Thanks in advance
> > > >
> > > > Daniel
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Daniel Walzenbach
Guest
Posts: n/a
 
      28th Jul 2003
Hi Carl,



I think I got it somehow to work. AFAIK by now I got my datasets somehow
messed up as I move them around between different asp.net pages.



Thank you!



Daniel.



P.S. It's difficult for me to post you some code as the .DefaultView method
works (as I told you) when used with a simple page. I would have to post you
the project and the related tables for you to reproduce my problem. Thanks
though for your offer!!




"Carl Prothman [MVP]" <(E-Mail Removed)> schrieb im Newsbeitrag
news:#(E-Mail Removed)...
> Daniel,
> Please post some code that repros the problem.
>
> --
>
> Thanks,
> Carl Prothman
> Microsoft ASP.NET MVP
> http://www.able-consulting.com
>
>
> "Daniel Walzenbach" <(E-Mail Removed)> wrote in

message news:(E-Mail Removed)...
> > Carl,
> >
> >
> >
> > this is how I expected it should be but nevertheless I get different
> > results. Do you know anything about the "cursor position" part in the
> > definition of a DataView as it is written in the MSDN? It seems that I
> > always get back a single cursor row but I don't know why and how to

prove my
> > assumption?
> >
> >
> >
> > Thank you Carl for your help!! I appreciate your efforts.
> >
> >
> >
> > Daniel
> >
> >
> > "Carl Prothman [MVP]" <(E-Mail Removed)> schrieb im Newsbeitrag
> > news:#2$(E-Mail Removed)...
> > > Daniel,
> > > I get the same count when using the following code:
> > >
> > > ' Note I create the sqlConnection1 and sqlDataAdapter1
> > > ' by dragging a Table from Server Explorer onto the WinForm.
> > > Dim ds As DataSet = New DataSet
> > > SqlDataAdapter1.Fill(ds, "customers")
> > >
> > > MsgBox("Rows.Count = " & ds.Tables("customers").Rows.Count)
> > > MsgBox("DefaultView.RowFilter = " &

> > ds.Tables("customers").DefaultView.RowFilter)
> > > MsgBox("DefaultView.RowStateFilter = " &

> > ds.Tables("customers").DefaultView.RowStateFilter.ToString())
> > > MsgBox("DefaultView.Count = " &

ds.Tables("customers").DefaultView.Count)
> > >
> > > --
> > >
> > > Thanks,
> > > Carl Prothman
> > > Microsoft ASP.NET MVP
> > > http://www.able-consulting.com
> > >
> > >
> > > "Daniel Walzenbach" <(E-Mail Removed)> wrote in

> > message news:ehhn#(E-Mail Removed)...
> > > > Carl,
> > > >
> > > >
> > > >
> > > > I have checked those as well and they seem to be fine. However

> > .RowFilter is
> > > > set to "" (String.Empty) and .RowStateFilter ist set to

"CurrentRows".
> > > >
> > > > I have also read on
> > > >

> >

http://msdn.microsoft.com/library/de...us/cpref/html/
> > > > frlrfsystemdatadatatableclassdefaultviewtopic.asp that the

DefaultView
> > > > Property is "a customized view of the table which may include a

filtered
> > > > view, or a cursor position." I assume it somehow returns a cursor

> > position
> > > > but I'm not sure why.
> > > >
> > > > Thanks
> > > >
> > > > Daniel
> > > >
> > > >
> > > > "Carl Prothman [MVP]" <(E-Mail Removed)> schrieb im Newsbeitrag
> > > > news:(E-Mail Removed)...
> > > > > Daniel,
> > > > > What are the values for the following properties?
> > > > > ds.Tables(0).DefaultView.RowFilter
> > > > > ds.Tables(0).DefaultView.RowStateFilter
> > > > >
> > > > > --
> > > > >
> > > > > Thanks,
> > > > > Carl Prothman
> > > > > Microsoft ASP.NET MVP
> > > > > http://www.able-consulting.com
> > > > >
> > > > >
> > > > > "Daniel Walzenbach" <(E-Mail Removed)>

wrote in
> > > > message news:(E-Mail Removed)...
> > > > > Hi,
> > > > >
> > > > > I have the following scenario:
> > > > >
> > > > > myDataSet.Tables("tblCustomer").Rows.Count = 4
> > > > >
> > > > > This is quite fine as the table contains 4 rows. However
> > > > >
> > > > > myDataSet.Tables("tblCustomer").DefaultView.Count = 1
> > > > >
> > > > > is not exactly what I expected it to be (I thought the result

should
> > be
> > > > 4). Can anybody explain this behavior to me?
> > > > >
> > > > > Thanks in advance
> > > > >
> > > > > Daniel
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
PaperSizes.Count returns 0 pers Microsoft C# .NET 4 9th Mar 2010 04:36 PM
logic that returns a count =?Utf-8?B?ZF9raWdodA==?= Microsoft Excel Misc 8 18th May 2006 12:30 AM
Query that returns an item count?? =?Utf-8?B?WWVhaHllYWh5ZWFo?= Microsoft Access Queries 4 9th Dec 2005 06:18 PM
Count function returns nothing Sandra Microsoft Access Queries 1 26th Apr 2004 04:07 PM
COUNT() returns incorrect value Bill Mathews Microsoft Excel Worksheet Functions 1 16th Aug 2003 02:58 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:52 AM.