all groups > inetserver asp components > may 2004 >
You're in the

inetserver asp components

group:

How to create a component?


How to create a component? plandry
5/12/2004 10:26:08 AM
inetserver asp components:
Hi- I've been posting all over the place and trying to get a simple task accomplished- I have a web page running on a CE.NET device, that needs to access a database running on the device with SQL Server CE from an ASP. I haven't gotten a straight answer anywhere (even from MSFT), so I think I'm going to go the route of creating my own Component in C++ to handle this for me, that can be called from an ASP. I know this is inetserver (which isn't technically what runs on CE) but I was wondering if anyone could set me on the right track to building a component? Basically it's going to mirror the functionality of ADOCE, which is not supported on CE 4.2. Any tips/help would be greatly appreciated

Thanks
RE: How to create a component? plandry
5/13/2004 5:36:04 AM
Hi
Thanks for the response. The real heart of the question was - what steps do I have to go through to get a component (in my case a managed C# component that has been wrapped in a non-managed one using Interop and RegAsm.exe) registered on the system and referenced in an ASP. I have a Whatever.dll, and a Whatever.tlb, and I need to be able to call CreateObject("Whatever"). Just to be clear, this is all happening on the CE device..

Sorry if it was unclear, and I hope this is more on topic..

RE: How to create a component? yhhuang NO[at]SPAM online.microsoft.com
5/13/2004 6:18:55 AM
Hello Pete,

Based on my understanding, now you are developing asp page in CE.NET 4.2.
However, you are not sure how to implement to data access component under
this situation since adoce can't be used, right? Please post here if I have
misunderstood the problem.

Yes, ADO is not supported in WinCE 4.2. The only native SQLCE API available
is OLEDB. If you're trying to access SQLCE via vb script from your ASP
page, you'll probably need to write a wrapper around either OLEDB or
ADO.NET to do the operations you want on the database.

Enabling .NET on your platform is optional. However, including the .NET
Compact Framework in your platform has a number of benefits. The .NET
Compact Framework is a subset of the popular .NET Framework and is fully
supported by Visual Studio .NET 2003. It enables millions of Visual Studio
.NET developers to quickly and easily target your custom platform using
skills that they already know. Second, the .NET Compact Framework provides
a powerful, XML Web Services enabled execution environment for your
platform, including support for Windows Forms, Microsoft ADO .NET data
access, networking, and more.

Please understand that ADO.NET is the future of data access for Microsoft
data storage.

By the way, this question is better posted in microsoft.public.sqlserver.ce
group. This group is mostly focused on sql server CE questions. There are
many active Microsoft Microsoft SQL Server CE Team members in that group.
So I recommend that group to you.

Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
RE: How to create a component? yhhuang NO[at]SPAM online.microsoft.com
5/14/2004 5:22:39 AM
Hello Pete,

Thanks for the quick response. We have also received your email.

After reviewing your reply carefully, I think the problem is:
You developed a managed C# component and have data access layer in it. Then
you use InterOp and RegAsm.exe to register the C# component as a normal COM
component. Now you want to use this COM component in asp but failed, right?
If there is any misunderstandings, please feel free to point out.

If so, I think you met a limitation here. The .NET Compact Framework
supports a subset of the interoperability of the desktop .NET Framework. In
particular, you can make function calls into Win32 DLLs, but you cannot
call COM interfaces (a feature known as COM Interop).

.NET Compact Framework interoperability only supports calls into Win32
libraries. It does not support calls from Win32 into the .NET Compact
Framework. That is why you can't use InterOp here.

So for the time being, I think of two ways for you:

1) Stay in managed world and migrate to asp.net programming. So you can use
ado.net code directly in managed C# component. In this way, you don't need
to use InterOp any more and can improve the performance much.

2) Stay in unmanaged world. That means to call database accessing APIs
directly in a COM component. Then register the COM component and use it in
asp page.

I will also consult our CE Developerment team to see their advice on it. If
you have any more concerns on it, please feel free to post here. I am glad
to work with you on it.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
RE: How to create a component? yhhuang NO[at]SPAM online.microsoft.com
5/14/2004 6:59:39 AM
Hello Pete,

Thanks for the quick response. We have also received your email. I have
also consulted our CE Developerment team to see their advice on it.

After reviewing your reply carefully, I think the problem is:
You developed a managed C# component and have data access layer in it. Then
you use InterOp and RegAsm.exe to register the C# component as a normal COM
component. Now you want to use this COM component in asp but failed, right?
If there is any misunderstandings, please feel free to point out.

If so, I think you met a limitation here. The .NET Compact Framework
supports a subset of the interoperability of the desktop .NET Framework. In
particular, you can make function calls into Win32 DLLs, but you cannot
call COM interfaces (a feature known as COM Interop).

.NET Compact Framework interoperability only supports calls into Win32
libraries. It does not support calls from Win32 into the .NET Compact
Framework. That is why you can't use InterOp here.

So for the time being, the best way here is to stay in unmanaged world.
That means to call database accessing APIs directly in a COM component.
Then register the COM component and use it in asp page. For how to develop
data access part in unmanaged world, you can refer to some samples. The
SQLCE 2.0 product ships with two eVC samples. Take a look at NorthwindOleDb
in the SQL CE sample installation directory.

There is another solution which would be a hybrid between the two ¨C use
ASP pages as we don¡¯t have ASP.NET in CF, call to a ¡®shim¡¯ COM object
using an interface which pass request / response to and from the managed
code by some technologys like socket or
Microsoft.WindowsCE.Forms.MessageWindow class. Its not pretty, but it¡¯s
the best on offer right now.

Does that answer your question?

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ?www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
AddThis Social Bookmark Button