.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

private deployment of SQL CE & accesss from unmanaged code. Possibel?

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :Sql Server


is it possible to access an sql ce database from unmanaged code, if i do private deployment? Unfortunatelly we have some  scenarios where we must assume that neither .net frameork nor sql ce is installed. Do we have any chance to use sql-ce in this scenarios?

Thanks in advance!










View Complete Post

More Related Resource Links

CLR Inside Out: Marshaling between Managed and Unmanaged Code


Marshaling is an important part of .NET interop. It allows you to call into unmanaged code from managed code. This column will help you get started.

Yi Zhang and Xiaoying Guo

MSDN Magazine January 2008

.NET Internals: Examine Running Processes Using Both Managed and Unmanaged Code


There are plenty of times when you need to get information on running processes, not the least of which is during performance tuning. Using the techniques in this article and special .NET classes you'll see how to get a process' ID, name, priority, number of threads, kernel handle, and memory consumption, as well as its user-mode, kernel-mode, and total elapsed running time and put them to use in a custom app called AssemblyBrowser.

Christophe Nasarre

MSDN Magazine October 2004

C++ and ATL: Use ATL Server Classes to Expose Your Unmanaged C++ Code as an XML Web Service


Throughout this issue, you'll read all about the promise of Web Services and how the .NET Framework enables Web Service development. Many people will also be building their Web Services atop C++ code and frameworks like ATL Server, particularly when performance is paramount. In this article, the authors show how fully functional Web Services are built using ATL Server and Visual Studio .NET. Beginning with unmanaged C++ classes, they add ATL attributes that make the code work over HTTP.

Kirk Fertitta and Chris Sells

MSDN Magazine December 2002

using managed code in unmanaged c++

I wanna use a managed c++ class and its functions (in which I wanna use interop services to wrap a COM based dll) in unmanaged codes is it possible? I mean, I feel like this maybe the case of JWNW(just will not work :D my alternate to IJW). This way seems to be scary and troubling  COM->C++/CLI->C++ and someone can remind me what was the function to call with System::Runtime::InteropServices (Visual c++ intellisense does not help me much there). Mmmm I had a few small projects calling unmanaged code in managed one ( using "pragma"s ) but I have no ideas for other way around. Can anyone direct me in right direction? I do not expect you to provide full working examples but seeing some conceptual FOO solutions would be most appreciated :D Thank you for your time :) Volkan

Sharing a file handler between managed and unmanaged code?

This is related to Interops, and sharing a file handler between a WPF UI and a native C++ DLL. I'm working on an application using MVVM as a guide. I want to use WPF for the UI, however it is a complex scientific application, which requires performance, and I am using C++ along with some GPU based code for all the modeling/processing. This is a Windows based app, no real network comm involved. I come across a challenge in terms of storing data. The data is multi-dimensional, and can be projected in many ways, while each projection can be processed/filtered in many ways too. I end up with a tree of data, with the raw data at the root and many branches. XML seems like an ideal way to store the information about this dataset, but as far as the raw data, it is not so convenient. I read about base64 encoding and the various binary-XML techniques, but see a major issue: the size of the converted data (150% of the raw) which in my case is huge (raw data is easily 200MBs+, and the multitude of projections can make it several 100's of MBs easily). There is the option of saving several files, but then it may become a nightmare for a user to 'transfer' files properly, so a one-file system seems best. I basically need to have the XML-like structure accessible to the UI, while the raw data needs to be accessed by the unmanaged code. So I was thinking I could concat

MSSQL CE 3.5 SP2 Private Deployment

I use Visual C# express 2008 for my development.  I use MSSQL CE3.5 SP1 and have deployed this will my application for over a year as a private deployment (just included all the DLLs in my project).  This has worked well and kept me from being dependent on the product deployments.  I am running into an issue with the application deploying on Windows 7 64-bit home edition.  From my readings it seems that I need to upgrade to the MSSQL CE 3.5 SP2 but the indication is that I need to deploy 32-bit and the 64-bit SP2 for the 64-bit environements.  Since my development environment is on Windows XP I have not found a way to obtain the 64-bit version of the DLLs to include in my project as a private deployment.  Can I do this?  Is there a better way?  Where can I get the 64-bit DLLs. Thanks in advance for any help anyone can provide.David Allen

Unmanaged Code

What is the difference between UnManaged code & UnSafe code???? Explain with an example  please ???? 

Deployment of Website created VS2005 with VB.Net code behind

Hi everyone, I am newbie creating websites.  This is my first and I am having problems with deployment and accessing.  Either I am doing something wrong or I am leaving something out.  I have tried several different methods of deployment using VS 2005 Professional version.  The website will be used by internal users, using company's own servers.  Deployment methods appear to be successful, but I do not see how to run the website.  I guess I need the step by step instructions on deployment.

Pointer into array when calling unmanaged code on 64 bit

I need to write a .Net-Frontend for an unmanaged Windows DLL which contains an API that must not be changed. My frontend works perfectly with the 32-bit version of the DLL. I have trouble using the 64-bit version of the DLL, because some functions expect a void pointer and interpret it as a pointer into an integer array. I boiled the problem down to this simple function: extern "C" int PASCAL EXPORT ExportedFunction(void *data) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); // Hier normaler Funktionsrumpf int *arr = (int *)data; arr[0]++; arr[1]++; arr[2]++; return sizeof(int); } Here is a stripped down version of my attempts to call "ExportedFunction": Imports System.Runtime.InteropServices Public Class Form1 Declare Function ExportedFunction Lib "testlib.dll" (<MarshalAs(UnmanagedType.I4)> ByRef parameter As Integer) As Integer Declare Function ExportedFunction2 Lib "testlib.dll" Alias "ExportedFunction" (ByVal parameter() As Integer) As Integer Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim arr() As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} Dim intsize As Integer = ExportedFunction(arr(6)) Console.WriteLine("SizeOf int in DLL: " & intsize.ToString) Console.Wri

No return from unmanaged code, methods to catch exception?


I am developing a c# application that needs to calls functions from a c header file. I use

[System.Runtime.InteropServices.DllImport("xxx.dll", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true,SetLastError=true)]
        public static extern Byte xxxx(IntPtr hResourceContext, ushort xxxx, ref structa aaa,ref Result_struct Result, Byte b);

to import the dll method. When I call this method in C#, the application simply exits without throwing an exception or error. I've used similar approach for other methods from the same dll which involves passing nested structs as parameter and they work fine. I would like to know how I can debug the code/ catch errors/exceptions from the unmanaged code.

I tried to include the SetLastError=true during DllImport but it does not help.


Is the executable file generated by compiler a Managed code or Unmanaged code ?



when we compile our vb.net or c#.net code (say in a simple console application) then in bin\Debug folder a .exe file is created.Is that a managed code? when i directly execute this file,will this target CLR ? or will it directly run on OS ?

Why there is ConsoleApplication1.vshost.exe.manifest files created in that folder ?

What is .pdb file ?

That executable file is also created in obj\Debug folder .Why ?

Windows Service crashing on call to unmanaged code, even though console app version works


I have a C# program that at some point calls 2 functions from an unmanaged dll using p/invoke.  Everything works fine when I'm running in a console app.  When I compile the same program as a windows service and run it, it crashes.  The console app and service should be identical as far as my code is concerned... all either program does is create an object from another assembly of mine and run a Start() method on it.

I have used VS2010 to debug the managed and unmanaged code, and when I step through the Console app everything looks great.  When I attach the debugger to the service, i can step through the first function in the unmanaged code, control returns to the managed code, and then later when it comes to the point where it calls the second unmanaged function, the process terminates immediately before the debugger steps into the first line of unmanaged code.  There are no exceptions that I can see, and the only thing written to the event log is the generic "service terminated unexpectedly" message.  Running "sc query" on the command line lets me know the win32_exit_code is 1067.

Im running everything in .net 4, on winxp 32bit.  The serivce is running as Local System ideally, but the same behavior exists when I run it under my user account. 

SSC 3.5 SP2 Private Deployment issue on Windows Mobile with SSC 3.5 (3.5.5386) installed


I want to deploy applications that use Private Deployment for SQL Server Compact 3.5 SP2 for Windows Mobile.
I made test sample according to SQL Server Compact 3.5 Service Pack 2 Books Online instructions.

I tested with WM 6.5 device and emulator.

I deploy to application folder on WM the following files:
C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Devices\System.Data.SqlServerCe.dll
C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500\armv4i\sqlceme35.dll
C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500\armv4i\sqlceqp35.dll
C:\Program Files\Microsoft SQL Server Compact Edition\v3.5\Devices\wce500\armv4i\sqlcese35.dll

The code is simple:
using (SqlCeConnection sqlCeConnection = new SqlCeConnection())
   button1.Text = sqlCeConnection.ServerVersion;

When I run my test on clean WM 6.5(with SSCE 3.1 in ROM), it's ok. Server version is 3.5.8080.0.

When I run my test on WM 6.5 with SSC 3.5 SP1 installed, test fails with the error:
The application is trying to load native components of version 5386 that are incompatible with ADO.NET provider of version 8080.
Incompatible versions can lead to application instability and hence loading of SQL Server Compact has been aborted.

Private deployment of SQL CE 3.5 SP2 on .NET 4.0 blocked by no aparrent way to private deploy the Vi


I find many discussion threads on this topic, some a lot clearer than others, but I really am trying to avoid having to include either the .NET Framework 2.0 or Visual C++ Runtime 2005 in my ClickOnce deployment of a .NET 4.0 application for which I strongly want to do a private deployment.  I'm deploying to hundreds to thousands of machines outside of the corporate umbrella, and I really want to minimize the number of dependencies outside the application.  My current goal is to keep it to JUST .NET 4.0 (and the windows installer to support that).  However, installs on clean Windows XP SP2 and SP3 machines fail to load the private deployment of SQL CE engine.  It's frustrating that everyone seems to give up and fall back on doing full installs of more prereqs.

Based on reviewing the threads out there, I feel pretty confident that I understand the problem, and I can get it to work by just my .NET 4.0 ClickOnce prereq and then a manual install of the Visual C++ 2005 Runtime redistributable.  Therefore, I am convinced I have everything working other than the VC runtime.  As far as I have read, I am supposed to be able to do a "private assemblies" deployment of the VC runtime as well by including in my copy deployment the Microsoft.VC80.CRT and Microsoft.VC80.MFC that are available under a VS.NET 2005 install.

VB2008 Express and SQL Server CE 3.5 private deployment issues


Windows Forms application developed with VB 2008 Express.
Using private deployment as described in SQL Server Books Online.
Deploying SQL CE version 3.5.8080.0.
Development system is 32 bit Windows 7 Home Premium SP1 version 6.1.7601.65536.
System installed SQL CE version is 3.5.8080.0.

For several months of development there have been no issues with this setup.  A month or so ago I began getting an occasional error message while making updates to the application in the development environment.  The message dialog would come in waves of three several minutes apart and would subside once I rebuilt the project.  The error message is "Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider version 8080".
The application uses a designer generated DataSet.  While trying to add an additional TableAdapter from the DataSet to the main form the above mentioned error dialog, for which I would click OK, would try to prevent changes from being made.  After several design environment restarts and restoring the impacted form.Designer.vb and .resx files I could finally complete making changes in the form designer.

The changes in the designer were not carried over into the

Private deployment: CRT binary not signed?


I want to use SQL CE 4 in my WPF application. I've added the contents of SQLCE's Private/ folder to my project and modified the app.config, as described here. The application worked fine with SQL CE 4 before I switched to private deployment.

When I run the application, I get a SqlCeException, the message roughly translates to "The CRT binary in the application/bin folder is not signed and might pose a security risk. Put the original Microsoft CRT binary in the application/bin folder."

I used Windows Explorer to check all dll's in the x86/Microsoft.VC90.CRT and amd64/Microsoft.VC90.CRT folders, they are digitally signed.

Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend