Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / March 2008

Tip: Looking for answers? Try searching our database.

Instance of dataview comes across as 'type Boolean' -- not sure why

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alex - 29 Feb 2008 21:32 GMT
Hey Everyone,

1: Public Function GetCustomerInfo(ByVal intCustomerID as Integer) as
DataView
2:     Dim dtCustomerInfo As DataTable = _dtCustomerInfo
3:     Dim dvCustomerInfo As DataView = _
4:       dtCustomerInfo.DefaultView.RowFilter = "CustomerID= " +
CStr(intCustomerID)
5:     Return dvCustomerInfo

Does anyone see an issue with these two statements?  _dtCustomerInfo
is a datatable being populated earlier in the class, but I don't want
to modify the Defaultview so I created dtCustomerInfo to do the dirty
work within this function.  The error I'm getting is this on line 4
(Entire line is underlined):
Value of type 'Boolean' cannot be converted to 'System.Data.DataView'.

It's acting like dtCustomerInfo.DefaultView.RowFilter = "CustomerID= "
+ CStr(intCustomerID) is of type Boolean instead of DataView.  What am
I doing wrong?  I even tried just using this;
dtCustomerInfo.DefaultView.RowFilter = "CustomerID=1"
... but I get the same results.

Any suggestions?  This is a WinForm using Visual Basic 2005.

Alex
Steve Gerrard - 01 Mar 2008 03:17 GMT
> Hey Everyone,
>
[quoted text clipped - 15 lines]
> It's acting like dtCustomerInfo.DefaultView.RowFilter = "CustomerID= "
> + CStr(intCustomerID) is of type Boolean instead of DataView.

On line 3, you are assigning something to dvCustomerInfo. What are you
assigning? The entire expression on Line 4, which is a comparison of the
RowFilter of the default view to the string "CustomerID= " +
CStr(intCustomerID). A boolean, in other words.

If you want a new view (good idea), then do
   Dim dvCustomerInfo As DataView = New DataView(_dtCustomerInfo)

You can then set the RowFilter property of the new view:
   dvCustomerInfo.RowFilter = "CustomerID= " + CStr(intCustomerID)

One thing at a time, in other words.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.