locked
Access sdf database on webserver RRS feed

  • Question

  • Helo,

    I like to put a SDF database on the web and access it by visual basic. I maked a database called test.sdf. I have a windows hosting acount at a webserver. I put the database in the directory App_Data.

    1. How can i access this database by using visual basic. Is there a way. (I read something about web.config, but i don't now this is the soulotion or how to config this file)
    2. Can I give the databse premmission for cache

    Thnak you so much

    Wouter
    • Moved by Yichun Feng Monday, March 23, 2009 9:25 AM about SDF (Moved from Visual Basic General to Visual Studio Smart Device Development – Visual Basic and C# Projects)
    Sunday, March 22, 2009 8:28 AM

Answers

  • Hi Wouter,

    SQL Sever CE (.sdf) can be used on desktop application as a local store. But it is not designed to be used in ASP.NET applications(concurrent or multi-use scenarios). By default, the connection from ASP.NET is blocked. You can use the following code to change the default behavior:
       AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true) 

    Still you should understand the limitations to use SQL CE database in ASP.NET.

    The following blog entry has detailed explanations on this:
    http://blogs.msdn.com/stevelasker/archive/2006/11/27/sql-server-compact-edition-under-asp-net-and-iis.aspx 

    Regards,
    Chunsheng Tang
    Please mark the post that helps you, and unmark that does not. This benefits our community members.
    • Proposed as answer by ErikEJMVP Tuesday, March 24, 2009 8:11 AM
    • Marked as answer by warrentang Friday, March 27, 2009 1:53 AM
    Tuesday, March 24, 2009 4:01 AM

All replies

  • Hi Wouter van reeven,

    I am moving this thread from Base "Visual Basic" forum to the "Smart Device" forum, since SDF database is related to Smart device development. There are more  experts in that forum.


    Best Regards

    Yichun Feng


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Monday, March 23, 2009 9:24 AM
  • Hi Wouter,

    SQL Sever CE (.sdf) can be used on desktop application as a local store. But it is not designed to be used in ASP.NET applications(concurrent or multi-use scenarios). By default, the connection from ASP.NET is blocked. You can use the following code to change the default behavior:
       AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true) 

    Still you should understand the limitations to use SQL CE database in ASP.NET.

    The following blog entry has detailed explanations on this:
    http://blogs.msdn.com/stevelasker/archive/2006/11/27/sql-server-compact-edition-under-asp-net-and-iis.aspx 

    Regards,
    Chunsheng Tang
    Please mark the post that helps you, and unmark that does not. This benefits our community members.
    • Proposed as answer by ErikEJMVP Tuesday, March 24, 2009 8:11 AM
    • Marked as answer by warrentang Friday, March 27, 2009 1:53 AM
    Tuesday, March 24, 2009 4:01 AM