paging dataset sql CE

M

merco

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.
 
M

merco

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

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

merco

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

Daniel Moth

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
 
M

merco

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

merco

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 ?
 
D

Daniel Moth

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top