TypedView not working with CF 2.0

Posts   
 
    
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 12-Jan-2007 20:24:15   

Hi All,

I'm having a problem with this piece of code:

Imports MedfordSchoolDistrict.MobileStaffDevice.DatabaseSpecific
Imports MedfordSchoolDistrict.MobileStaffDevice.EntityClasses
Imports MedfordSchoolDistrict.MobileStaffDevice.FactoryClasses
Imports MedfordSchoolDistrict.MobileStaffDevice.HelperClasses
Imports MedfordSchoolDistrict.MobileStaffDevice.RelationClasses
Imports MedfordSchoolDistrict.MobileStaffDevice.TypedViewClasses
Imports MedfordSchoolDistrict.MobileStaffDevice
Imports SD.LLBLGen.Pro.ORMSupportClasses


Public Class StaffManager


    Public Shared Function GetDepartmentEmployees() As VwDepartmentEmployeeNameTypedView

        Using adapter As New MobileDataAccessAdapter
            Dim vw As New VwDepartmentEmployeeNameTypedView

            adapter.FetchTypedView(vw)
            Return vw

        End Using
    End Function

I get the following error when I try to use GetDepartmentEmployess:

System.Data.SqlServerCe.SqlCeException was unhandled
  HResult=-2147217865
  Message=" [ vwDepartmentEmployeeName ]"
  NativeError=0
  Source="SQL Server 2005 Everywhere Edition ADO.NET Data Provider"
  StackTrace:
    at System.Data.SqlServerCe.SqlCeCommand.ProcessResults()
    at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()
    at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand()
    at System.Data.SqlServerCe.SqlCeCommand.ExecuteReader()
    at System.Data.SqlServerCe.SqlCeCommand.ExecuteDbDataReader()
    at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
    at System.Data.Common.DbDataAdapter.FillInternal()
    at System.Data.Common.DbDataAdapter.Fill()
    at System.Data.Common.DbDataAdapter.Fill()
    at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteMultiRowDataTableRetrievalQuery()
    at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedView()
    at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchTypedView()
    at MobileStaffDeviceBl.StaffManager.GetDepartmentEmployees()
    at MobileStaffDevice.frmMain.frmMain_Load()
    at System.Windows.Forms.Form.OnLoad()
    at System.Windows.Forms.Form._SetVisibleNotify()
    at System.Windows.Forms.Control.set_Visible()
    at System.Windows.Forms.Application.Run()
    at MobileStaffDevice.frmMain.Main()

Any help would be appreciated.

Fishy

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 12-Jan-2007 21:27:53   

Hmm, how do these '[]' appear in the query I wonder... SqlCE doesn't support '[]' and the SqlCE DQE doesn't emit '[]' in the query...

The view exists in the db?

Frans Bouma | Lead developer LLBLGen Pro
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 12-Jan-2007 21:53:35   

Yes, the view exists in the db.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 13-Jan-2007 10:56:07   

Could you override in the DataAccessAdapter class you're using the method OnFetchTypedView and grab the query SQL string from the passed in selectQuery object? The error message is too vague (as usual on the (#$&@(#@$#@ cf.net framework rage )

Frans Bouma | Lead developer LLBLGen Pro
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 16-Jan-2007 19:32:17   

Otis wrote:

Could you override in the DataAccessAdapter class you're using the method OnFetchTypedView and grab the query SQL string from the passed in selectQuery object? The error message is too vague (as usual on the (#$&@(#@$#@ cf.net framework rage )

I don't know how to do that.

Could you send me some sample code in vb?

Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 16-Jan-2007 20:01:17   

Walaa wrote:

Using the Overrides keyword.

Results of a google search: http://www.vbip.com/books/1861004915/chapter_4915_06.asp http://www.java2s.com/Code/VB/Class/Overridesmethodfromsuperparentclass.htm http://www.informit.com/articles/article.asp?p=170719

Sorry about that. I should have researched that on my own.

Thank you.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 16-Jan-2007 20:08:07   

no problem at all.

This is a developers community and we are here to help each other, whatever the questions are. So feel free to ask about anything.

Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 18-Jan-2007 16:56:46   

I found an obscure footnote:

Note: You may see options to select Views, Stored Procedures, and Functions, but SQL Mobile doesn't actually support these. This is a bug that's scheduled to be fixed.

disappointed

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 20-Jan-2007 17:04:04   

I didn't look into the CE spec when I first answered the thread, but indeed CE doesn't support views, so I then wonder: you answered 'yes' on my question if that view was in the db confused

Frans Bouma | Lead developer LLBLGen Pro
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 22-Jan-2007 16:40:47   

When I did the replication I saw all the tables and views as files in file explorer. So I assumed that the view was there. Sorry for the confusion.flushed