How to use Stored Procedure in SqlCE

回眸只為那壹抹淺笑 提交于 2019-12-09 14:29:10

问题


I have just installed Sql Server Compact Edition. To my surprise, we can't use stored procedure in sql server CE. Do I have any alternative of Stored Procedure in Sql Server CE. I am strongly obsessed with stored procedure, I can'nt think of an application without stored procedures.

Please help, Thanks in advance.

Edit: Can I use Managed Stored Procedures.


回答1:


SqlCe is a local database for use by an application. There is no need for stored procedures since the database is just a local data store, and the business logic is in the application. It is not an engine. If you need an engine then use SqlExpress or its big brother. See Steve Lasker's Comparing SQL Server Express and Compact Editions Whitepaper at http://download.microsoft.com/download/A/4/7/A47B7B0E-976D-4F49-B15D-F02ADE638EBE/Compact_Express_Comparison.doc. It explains everything you need to know.

No, you cannot use managed stored procedures. SqlCe is in-process.

Also, you might find Data Storage Architecture with SQL Server 2005 Compact Edition at http://msdn.microsoft.com/en-us/library/bb380177(SQL.90).aspx helpful.




回答2:


This blog from Steve Lasker describes how you can implement something similar to sprocs on SQL Server Compact: http://blogs.msdn.com/stevelasker/archive/2008/02/11/stored-procedures-and-sql-server-compact-the-great-debate.aspx




回答3:


You will have to use inline sql in your application. Use SqlCeCommand.CommandText Property to specify sql text.




回答4:


I don't really know what is supported by SQL Server CE, but UDFs can often be substituted for stored procedures. If that doesn't help, try calculated columns and/or indexed views. If those are not available as options, then I think you are stuck with putting the logic in your application.



来源:https://stackoverflow.com/questions/2078672/how-to-use-stored-procedure-in-sqlce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!