HighTechTalks DotNet Forums  

paging dataset sql CE

Dotnet Framework (Compact Framework) microsoft.public.dotnet.framework.compactframework


Discuss paging dataset sql CE in the Dotnet Framework (Compact Framework) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
merco
 
Posts: n/a

Default paging dataset sql CE - 03-21-2006 , 05:50 AM






hi,
i'm using this code
http://www.opennetcf.org/Forums/topic.asp?TOPIC_ID=235
to paging a dataset.
Due to customer specifications, i have to run my app both in PocketPc
and Desktop PC.

So i create to different classes called: NxDataCacheCE.vb and
NxDataCacheDesktop.VB.
In this classes i use System.Data.SqlServerCe and
System.Data.SqlClient.

To semplify my work i also use a class wrapper called NxDataCache:
Public Class NxDataCache
Private NxDcCE As NxDataCacheCE
Private NxDcDesktop As NxDataCacheDesktop


Public Sub New()
If Parametri.Palmare Then
NxDcCE = New NxDataCacheCE
NxDcDesktop = Nothing
Else
NxDcDesktop = New NxDataCacheDesktop
NxDcCE = Nothing
End If
End Sub
Public Sub PrepareData(ByVal SQL As String, ByVal DataWindow As
Integer, ByVal DataTableName As String)

If Parametri.Palmare Then
NxDcCE.PrepareData(Parametri.Cn_SQLCE, SQL, DataWindow,
DataTableName)
Else
NxDcDesktop.PrepareData(Parametri.Cn_SQL, SQL, DataWindow,
DataTableName)
End If
End Sub
Public Sub FillDS(ByVal StartFrom As Integer, ByVal Size As
Integer)
If Parametri.Palmare Then
NxDcCE.FillDS(StartFrom, Size)
Else
NxDcDesktop.FillDS(StartFrom, Size)
End If
End Sub
ReadOnly Property SQLData() As System.Data.DataTable
Get
If Parametri.Palmare Then
Return NxDcCE.SQLData

Else
Return NxDcDesktop.SQLData
End If
End Get
End Property
Protected Overrides Sub Finalize()
NxDcCE = Nothing
NxDcDesktop = Nothing
MyBase.Finalize()
End Sub
End Class

I get this error, when i call PrepareData
Could not load file or assembly 'System.Data.SqlServerCe,
Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or
one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040)

Why ? On pocketPC all runs ok.


Reply With Quote
  #2  
Old   
merco
 
Posts: n/a

Default Re: paging dataset sql CE - 03-21-2006 , 06:29 AM






a little workaround for this is using compiler directives:
#If PocketPC Then
....

but is not possible a kind of "late binding" in this case ?


Reply With Quote
  #3  
Old   
Daniel Moth
 
Posts: n/a

Default Re: paging dataset sql CE - 03-21-2006 , 09:08 AM



It is possible to use runtime checking but the best approach is to use
conditional compilation:
http://www.danielmoth.com/Blog/2004/...lframe_17.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

"merco" <d.mercanti (AT) gmail (DOT) com> wrote

Quote:
a little workaround for this is using compiler directives:
#If PocketPC Then
...

but is not possible a kind of "late binding" in this case ?




Reply With Quote
  #4  
Old   
merco
 
Posts: n/a

Default Re: paging dataset sql CE - 03-21-2006 , 10:10 AM



ok,
you talk about " VS2005 and partial classes" ...
In this case, is it possibile to use this feature ? I can't imagine
how...


Reply With Quote
  #5  
Old   
Daniel Moth
 
Posts: n/a

Default Re: paging dataset sql CE - 03-21-2006 , 10:21 AM



Partial classes have nothing to do with your specific problem. Yes they can
be used to assist in a bunch of code sharing scenarios. An ng post is not
enough to cover that but, again, don't get confused and look at the context
in which I mentioned that.

Your issue has to do with using different branches of code to target the two
platforms:
1. You can do that either by checking at runtime (see my retargetable blog
post and you already discovered that yourself).
2. Even better (and always with no restrictions) you can do the checking at
compile time. And that is described in the blog entry I directed you before.

If you have a specific problem statement please follow up here with your
specific question.

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

"merco" <d.mercanti (AT) gmail (DOT) com> wrote

Quote:
ok,
you talk about " VS2005 and partial classes" ...
In this case, is it possibile to use this feature ? I can't imagine
how...




Reply With Quote
  #6  
Old   
merco
 
Posts: n/a

Default Re: paging dataset sql CE - 03-21-2006 , 11:23 AM



ok,
you talk about " VS2005 and partial classes" ...
In this case, is it possibile to use this feature ? I can't imagine
how...


Reply With Quote
  #7  
Old   
merco
 
Posts: n/a

Default Re: paging dataset sql CE - 03-21-2006 , 03:05 PM



ok..
thanks
i'm doing the "compile time" way ...


Reply With Quote
  #8  
Old   
merco
 
Posts: n/a

Default Re: paging dataset sql CE - 03-22-2006 , 08:57 AM



another question is:
i currently use specific SQLce objects somewhere in my code (not a
class but a simple module without any runtime/cimpile problems): why i
get this error only when i use sqlce object in a class rather than in a
module ?


Reply With Quote
  #9  
Old   
Daniel Moth
 
Posts: n/a

Default Re: paging dataset sql CE - 03-22-2006 , 09:14 AM



Please start new threads for new questions especially if theoriginal thread
came to a conclusion.

To answer your question I need to see some code. I can guess but I'd rather
be sure...

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

"merco" <d.mercanti (AT) gmail (DOT) com> wrote

Quote:
another question is:
i currently use specific SQLce objects somewhere in my code (not a
class but a simple module without any runtime/cimpile problems): why i
get this error only when i use sqlce object in a class rather than in a
module ?




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.